Class: ROM::Factory::AttributeRegistry Private
- Inherits:
-
Object
- Object
- ROM::Factory::AttributeRegistry
- Includes:
- Enumerable, TSort
- Defined in:
- lib/rom/factory/attribute_registry.rb
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.
Instance Attribute Summary collapse
- #elements ⇒ Object readonly private
Instance Method Summary collapse
- #<<(element) ⇒ Object private
- #[](name) ⇒ Object private
- #associations ⇒ Object private
- #dup ⇒ Object private
- #each ⇒ Object private
-
#initialize(elements = []) ⇒ AttributeRegistry
constructor
private
A new instance of AttributeRegistry.
- #inspect ⇒ Object (also: #to_s) private
- #reject ⇒ Object private
- #values ⇒ Object private
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.
16 17 18 |
# File 'lib/rom/factory/attribute_registry.rb', line 16 def initialize(elements = []) @elements = elements end |
Instance Attribute Details
#elements ⇒ Object (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.
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.
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.
24 |
# File 'lib/rom/factory/attribute_registry.rb', line 24 def [](name) = detect { |e| e.name.equal?(name) } |
#associations ⇒ 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.
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 |
#dup ⇒ 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.
35 |
# File 'lib/rom/factory/attribute_registry.rb', line 35 def dup = self.class.new(elements.dup) |
#each ⇒ 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.
21 |
# File 'lib/rom/factory/attribute_registry.rb', line 21 def each(&) = elements.each(&) |
#inspect ⇒ Object 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.
48 49 50 |
# File 'lib/rom/factory/attribute_registry.rb', line 48 def inspect "#<#{self.class} #{elements.inspect}>" end |
#reject ⇒ 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.
45 |
# File 'lib/rom/factory/attribute_registry.rb', line 45 def reject(&) = self.class.new(elements.reject(&)) |
#values ⇒ 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.
38 |
# File 'lib/rom/factory/attribute_registry.rb', line 38 def values = self.class.new(elements.select(&:value?)) |