Class: ROM::Factory::AttributeRegistry Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable, TSort
Defined in:
lib/rom/factory/attribute_registry.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elements = []) ⇒ AttributeRegistry

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of AttributeRegistry.

API:

  • private



16
17
18
# File 'lib/rom/factory/attribute_registry.rb', line 16

def initialize(elements = [])
  @elements = elements
end

Instance Attribute Details

#elementsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



13
14
15
# File 'lib/rom/factory/attribute_registry.rb', line 13

def elements
  @elements
end

Instance Method Details

#<<(element) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



27
28
29
30
31
32
# File 'lib/rom/factory/attribute_registry.rb', line 27

def <<(element)
  existing = self[element.name]
  elements.delete(existing) if existing
  elements << element
  self
end

#[](name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



24
# File 'lib/rom/factory/attribute_registry.rb', line 24

def [](name) = detect { |e| e.name.equal?(name) }

#associationsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



41
42
43
# File 'lib/rom/factory/attribute_registry.rb', line 41

def associations
  self.class.new(elements.select { |e| e.is_a?(Attributes::Association::Core) })
end

#dupObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



35
# File 'lib/rom/factory/attribute_registry.rb', line 35

def dup = self.class.new(elements.dup)

#eachObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



21
# File 'lib/rom/factory/attribute_registry.rb', line 21

def each(&) = elements.each(&)

#inspectObject Also known as: to_s

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



48
49
50
# File 'lib/rom/factory/attribute_registry.rb', line 48

def inspect
  "#<#{self.class} #{elements.inspect}>"
end

#rejectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



45
# File 'lib/rom/factory/attribute_registry.rb', line 45

def reject(&) = self.class.new(elements.reject(&))

#valuesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



38
# File 'lib/rom/factory/attribute_registry.rb', line 38

def values = self.class.new(elements.select(&:value?))