Sha256: 28565d78230859cdccdb5e4d41079b3fcf33697e93466dda7c4ffc54368db296

Contents?: true

Size: 814 Bytes

Versions: 9

Compression:

Stored size: 814 Bytes

Contents

module Scrivito

#
# This class represents a collection of attribute definitions.
#
# @api private
#
class AttributeDefinitionCollection
  include Enumerable

  def initialize(attribute_definitions)
    @attribute_definitions = attribute_definitions
  end

  #
  # Iterates over the attribute definitions.
  #
  # @api private
  # @yieldparam [Scrivito:AttributeDefinition] attribute_definition
  #
  def each(&block)
    attribute_definitions.values.each(&block)
  end

  #
  # Find definition of an attribute.
  #
  # @api private
  # @param name [Symbol, String] the name of the attribute.
  # @return [Scrivito::AttributeDefinition, nil] attribute definition if found or +nil+ otherwise.
  #
  def [](name)
    attribute_definitions[name.to_sym]
  end

  private

  attr_reader :attribute_definitions
end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
scrivito_sdk-0.50.1 lib/scrivito/attribute_definition_collection.rb
scrivito_sdk-0.50.0 lib/scrivito/attribute_definition_collection.rb
scrivito_sdk-0.50.0.rc2 lib/scrivito/attribute_definition_collection.rb
scrivito_sdk-0.50.0.rc1 lib/scrivito/attribute_definition_collection.rb
scrivito_sdk-0.42.1 lib/scrivito/attribute_definition_collection.rb
scrivito_sdk-0.42.1.rc3 lib/scrivito/attribute_definition_collection.rb
scrivito_sdk-0.42.1.rc2 lib/scrivito/attribute_definition_collection.rb
scrivito_sdk-0.42.1.rc1 lib/scrivito/attribute_definition_collection.rb
scrivito_sdk-0.42.0 lib/scrivito/attribute_definition_collection.rb