Class: ROM::Relation::Composite

Inherits:
Pipeline::Composite show all
Includes:
Materializable
Defined in:
core/lib/rom/relation/composite.rb

Overview

Left-to-right relation composition used for data-pipelining

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from ROM::Pipeline::Composite

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

Returns:



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

Yields:

  • (Hash, Object)

#firstObject Originally defined in module Materializable

Return first tuple from a relation coerced to an array

Returns:

  • (Object)

#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

#oneObject Originally defined in module Materializable

Delegate to loaded relation and return one object

Returns:

  • (Object)

See Also:

#one!Object Originally defined in module Materializable

Delegate to loaded relation and return one object

Returns:

  • (Object)

See Also:

#to_aArray Also known as: to_ary Originally defined in module Materializable

Coerce the relation to an array

Returns:

  • (Array)