Class: ROM::Relation::Graph

Inherits:
Object
  • Object
show all
Extended by:
Initializer
Includes:
Memoizable, Pipeline, Pipeline::Proxy, Materializable
Defined in:
lib/rom/relation/graph.rb

Overview

Abstract relation graph class

Direct Known Subclasses

Combined, Wrap

Constant Summary

Constants included from Memoizable

Memoizable::MEMOIZED_HASH

Instance Attribute Summary collapse

Attributes included from Memoizable

#__memoized__

Instance Method Summary collapse

Methods included from Initializer

extended

Methods included from Pipeline::Proxy

#respond_to_missing?

Methods included from Pipeline::Operator

#>>

Methods included from Materializable

#each, #first, #one, #one!, #to_a

Methods included from Memoizable

included

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ROM::Pipeline::Proxy

Instance Attribute Details

#nodesArray<Relation> (readonly) Also known as: right

Returns An array with relation nodes.

Returns:

  • (Array<Relation>)

    An array with relation nodes



27
# File 'lib/rom/relation/graph.rb', line 27

param :nodes

#rootRelation (readonly) Also known as: left

Returns The root relation.

Returns:



23
# File 'lib/rom/relation/graph.rb', line 23

param :root

Instance Method Details

#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

Returns:

  • (true)


54
55
56
# File 'lib/rom/relation/graph.rb', line 54

def graph?
  true
end

#map_to(klass) ⇒ Graph

Map graph tuples to custom objects

Returns:

See Also:



76
77
78
# File 'lib/rom/relation/graph.rb', line 76

def map_to(klass)
  self.class.new(root.map_to(klass), nodes)
end

#map_with(*args) ⇒ Graph

Map graph tuples via custom mappers

Returns:

See Also:



65
66
67
# File 'lib/rom/relation/graph.rb', line 65

def map_with(*args)
  self.class.new(root.map_with(*args), nodes)
end

#mapperObject

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 'lib/rom/relation/graph.rb', line 83

def mapper
  mappers[to_ast]
end

#with_nodes(nodes) ⇒ Graph

Rebuild a graph with new nodes

Parameters:

Returns:



45
46
47
# File 'lib/rom/relation/graph.rb', line 45

def with_nodes(nodes)
  self.class.new(root, nodes)
end