class ROM::Factory::AttributeRegistry

@api private

Attributes

elements[R]

@api private

Public Class Methods

new(elements = []) click to toggle source

@api private

# File lib/rom/factory/attribute_registry.rb, line 16
def initialize(elements = [])
  @elements = elements
end

Public Instance Methods

<<(element) click to toggle source

@api private

# File lib/rom/factory/attribute_registry.rb, line 31
def <<(element)
  existing = self[element.name]
  elements.delete(existing) if existing
  elements << element
  self
end
[](name) click to toggle source

@api private

# File lib/rom/factory/attribute_registry.rb, line 26
def [](name)
  detect { |e| e.name.equal?(name) }
end
associations() click to toggle source

@api private

# File lib/rom/factory/attribute_registry.rb, line 49
def associations
  self.class.new(elements.select { |e| e.kind_of?(Attributes::Association::Core) })
end
dup() click to toggle source

@api private

# File lib/rom/factory/attribute_registry.rb, line 39
def dup
  self.class.new(elements.dup)
end
each(&block) click to toggle source

@api private

# File lib/rom/factory/attribute_registry.rb, line 21
def each(&block)
  elements.each(&block)
end
values() click to toggle source

@api private

# File lib/rom/factory/attribute_registry.rb, line 44
def values
  self.class.new(elements.select(&:value?))
end

Private Instance Methods

tsort_each_child(attr, &block) click to toggle source

@api private

# File lib/rom/factory/attribute_registry.rb, line 61
def tsort_each_child(attr, &block)
  attr.dependency_names.map { |name| self[name] }.compact.each(&block)
end
tsort_each_node(&block) click to toggle source

@api private

# File lib/rom/factory/attribute_registry.rb, line 56
def tsort_each_node(&block)
  each(&block)
end