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.
- #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.
14 15 16 |
# File 'lib/rom/factory/attribute_registry.rb', line 14 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.
11 12 13 |
# File 'lib/rom/factory/attribute_registry.rb', line 11 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.
29 30 31 32 33 34 |
# File 'lib/rom/factory/attribute_registry.rb', line 29 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 25 26 |
# File 'lib/rom/factory/attribute_registry.rb', line 24 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.
47 48 49 |
# File 'lib/rom/factory/attribute_registry.rb', line 47 def associations self.class.new(elements.select { |e| e.kind_of?(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.
37 38 39 |
# File 'lib/rom/factory/attribute_registry.rb', line 37 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.
19 20 21 |
# File 'lib/rom/factory/attribute_registry.rb', line 19 def each(&block) elements.each(&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.
42 43 44 |
# File 'lib/rom/factory/attribute_registry.rb', line 42 def values self.class.new(elements.select(&:value?)) end |