class ROM::Relation::Graph
Abstract relation graph class
@api public
Public Instance Methods
graph?()
click to toggle source
Return if this is a graph relation
@return [true]
@api private
# File lib/rom/relation/graph.rb, line 56 def graph? true end
map_to(klass)
click to toggle source
Map graph tuples to custom objects
@see Relation#map_to
@return [Graph]
@api public
# File lib/rom/relation/graph.rb, line 78 def map_to(klass) self.class.new(root.map_to(klass), nodes) end
map_with(*names, **opts)
click to toggle source
Map graph tuples via custom mappers
@see Relation#map_with
@return [Relation::Composite]
@api public
# File 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
mapper()
click to toggle source
@see Relation#mapper
@api private
# File lib/rom/relation/graph.rb, line 85 def mapper mappers[to_ast] end
to_ast()
click to toggle source
# File lib/rom/relation/graph.rb, line 90 def to_ast [:relation, [name.relation, attr_ast + nodes.map(&:to_ast), meta_ast]] end
with_nodes(nodes)
click to toggle source
Rebuild a graph with new nodes
@param [Array<Relation>] nodes
@return [Graph]
@api public
# File lib/rom/relation/graph.rb, line 47 def with_nodes(nodes) self.class.new(root, nodes) end
Private Instance Methods
composite_class()
click to toggle source
@api private
# File lib/rom/relation/graph.rb, line 102 def composite_class Relation::Composite end
decorate?(other)
click to toggle source
@api private
Calls superclass method
ROM::Pipeline::Proxy#decorate?
# File lib/rom/relation/graph.rb, line 97 def decorate?(other) super || other.is_a?(Composite) || other.is_a?(Curried) end