Class: ROM::Relation::Composite
- Inherits:
-
Pipeline::Composite
- Object
- Pipeline::Composite
- ROM::Relation::Composite
- Includes:
- Materializable
- Defined in:
- core/lib/rom/relation/composite.rb
Overview
Left-to-right relation composition used for data-pipelining
Instance Method Summary collapse
-
#call(*args) ⇒ Loaded
(also: #[])
Call the pipeline by passing results from left to right.
-
#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) ⇒ Object
-
#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.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ROM::Pipeline::Proxy
Instance Method Details
#call(*args) ⇒ Loaded Also known as: []
Call the pipeline by passing results from left to right
Optional args are passed to the left object
22 23 24 25 26 27 28 29 30 31 |
# File 'core/lib/rom/relation/composite.rb', line 22 def call(*args) relation = left.call(*args) response = right.call(relation) if response.is_a?(Loaded) response else relation.new(response) end 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) ⇒ Object
37 38 39 |
# File 'core/lib/rom/relation/composite.rb', line 37 def map_to(klass) self >> left.map_to(klass).mapper 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