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(&block) ⇒ Object private
-
#initialize(elements = []) ⇒ AttributeRegistry
constructor
private
A new instance of AttributeRegistry.
- #reject(&block) ⇒ 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.
31 32 33 34 35 36 |
# 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) ⇒ 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.
26 27 28 |
# File 'lib/rom/factory/attribute_registry.rb', line 26 def [](name) detect { |e| e.name.equal?(name) } end |
#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.
49 50 51 |
# File 'lib/rom/factory/attribute_registry.rb', line 49 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.
39 40 41 |
# File 'lib/rom/factory/attribute_registry.rb', line 39 def dup self.class.new(elements.dup) end |
#each(&block) ⇒ 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 22 23 |
# File 'lib/rom/factory/attribute_registry.rb', line 21 def each(&block) elements.each(&block) end |
#reject(&block) ⇒ 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.
53 54 55 |
# File 'lib/rom/factory/attribute_registry.rb', line 53 def reject(&block) self.class.new(elements.reject(&block)) end |
#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.
44 45 46 |
# File 'lib/rom/factory/attribute_registry.rb', line 44 def values self.class.new(elements.select(&:value?)) end |