Class: ROM::Relation::Graph
- Inherits:
-
Object
- Object
- ROM::Relation::Graph
- Extended by:
- Initializer
- Includes:
- Memoizable, Pipeline, Pipeline::Proxy, 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
- #__memoized__ ⇒ Object included from Memoizable readonly private
-
#nodes ⇒ Array<Relation>
(also: #right)
readonly
An array with relation nodes.
-
#root ⇒ Relation
(also: #left)
readonly
The root relation.
Instance Method Summary collapse
-
#>>(other) ⇒ Relation::Composite
included
from Pipeline::Operator
Compose two relation with a left-to-right composition.
-
#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.
-
#graph? ⇒ true
private
Return if this is a graph relation.
-
#map_to(klass) ⇒ Graph
Map graph tuples to custom objects.
-
#map_with(*names, **opts) ⇒ Relation::Composite
Map graph tuples via custom mappers.
- #mapper ⇒ Object private
-
#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.
- #respond_to_missing?(name, include_private = false) ⇒ Boolean included from Pipeline::Proxy private
-
#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
#__memoized__ ⇒ Object (readonly) Originally defined in module Memoizable
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.
#nodes ⇒ Array<Relation> (readonly) Also known as: right
Returns An array with relation nodes.
27 |
# File 'core/lib/rom/relation/graph.rb', line 27 param :nodes |
#root ⇒ Relation (readonly) Also known as: left
Returns The root relation.
23 |
# File 'core/lib/rom/relation/graph.rb', line 23 param :root |
Instance Method Details
#>>(other) ⇒ Relation::Composite Originally defined in module Pipeline::Operator
Compose two relation with a left-to-right composition
#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
#graph? ⇒ true
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.
Return if this is a graph relation
54 55 56 |
# File 'core/lib/rom/relation/graph.rb', line 54 def graph? true end |
#map_to(klass) ⇒ Graph
Map graph tuples to custom objects
76 77 78 |
# File 'core/lib/rom/relation/graph.rb', line 76 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
65 66 67 |
# File 'core/lib/rom/relation/graph.rb', line 65 def map_with(*names, **opts) names.reduce(self.class.new(root.with(opts), nodes)) { |a, e| a >> mappers[e] } end |
#mapper ⇒ 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.
83 84 85 |
# File 'core/lib/rom/relation/graph.rb', line 83 def mapper mappers[to_ast] 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
#respond_to_missing?(name, include_private = false) ⇒ Boolean Originally defined in module Pipeline::Proxy
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.
#to_a ⇒ Array Also known as: to_ary Originally defined in module Materializable
Coerce the relation to an array