Class: ROM::Relation::Graph
- Inherits:
-
Object
- Object
- ROM::Relation::Graph
- Includes:
- Materializable
- Defined in:
- core/lib/rom/relation/graph.rb,
changeset/lib/rom/changeset/extensions/relation.rb
Overview
Changeset extenions for combined relations
Instance Attribute Summary collapse
-
#nodes ⇒ Array<Relation>
(also: #right)
readonly
An array with relation nodes.
-
#root ⇒ Relation
(also: #left)
readonly
The root relation.
Instance Method Summary collapse
-
#changeset ⇒ Object
Build a changeset for a combined relation.
-
#each {|Hash, Object| ... } ⇒ Object
included
from Materializable
Yield relation tuples.
-
#first ⇒ Object
included
from Materializable
Return first tuple from a relation coerced to an array.
-
#map_to(klass) ⇒ Graph
Map graph tuples to custom objects.
-
#map_with(*names, **opts) ⇒ Relation::Composite
Map graph tuples via custom mappers.
-
#one ⇒ Object
included
from Materializable
Delegate to loaded relation and return one object.
-
#one! ⇒ Object
included
from Materializable
Delegate to loaded relation and return one object.
-
#to_a ⇒ Array
(also: #to_ary)
included
from Materializable
Coerce the relation to an array.
-
#with_nodes(nodes) ⇒ Graph
Rebuild a graph with new nodes.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ROM::Pipeline::Proxy
Instance Attribute Details
#nodes ⇒ Array<Relation> (readonly) Also known as: right
Returns An array with relation nodes.
29 |
# File 'core/lib/rom/relation/graph.rb', line 29 param :nodes |
#root ⇒ Relation (readonly) Also known as: left
Returns The root relation.
25 |
# File 'core/lib/rom/relation/graph.rb', line 25 param :root |
Instance Method Details
#changeset ⇒ Object
Build a changeset for a combined relation
20 21 22 |
# File 'changeset/lib/rom/changeset/extensions/relation.rb', line 20 def changeset(*) raise NotImplementedError, "Changeset doesn't support combined relations yet" end |
#each {|Hash, Object| ... } ⇒ Object Originally defined in module Materializable
Yield relation tuples
#first ⇒ Object Originally defined in module Materializable
Return first tuple from a relation coerced to an array
#map_to(klass) ⇒ Graph
Map graph tuples to custom objects
78 79 80 |
# File 'core/lib/rom/relation/graph.rb', line 78 def map_to(klass) self.class.new(root.map_to(klass), nodes) end |
#map_with(*names, **opts) ⇒ Relation::Composite
Map graph tuples via custom mappers
67 68 69 |
# File 'core/lib/rom/relation/graph.rb', line 67 def map_with(*names, **opts) names.reduce(self.class.new(root.with(opts), nodes)) { |a, e| a >> mappers[e] } end |
#one ⇒ Object Originally defined in module Materializable
Delegate to loaded relation and return one object
#one! ⇒ Object Originally defined in module Materializable
Delegate to loaded relation and return one object
#to_a ⇒ Array Also known as: to_ary Originally defined in module Materializable
Coerce the relation to an array