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