Module: Pacer::Core::Graph::GraphRoute

Included in:
PacerGraph
Defined in:
lib/pacer/core/graph/graph_route.rb

Overview

This module adds route methods to the basic graph classes returned from the blueprints library.

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



43
44
45
# File 'lib/pacer/core/graph/graph_route.rb', line 43

def ==(other)
  equal?(other)
end

#e(*filters, &block) ⇒ Object

Returns a new route to all graph edges. Standard filter options.



16
17
18
19
20
21
22
# File 'lib/pacer/core/graph/graph_route.rb', line 16

def e(*filters, &block)
  filters = Pacer::Route.edge_filters(self, filters)
  route = chain_route :element_type => :edge,
    :pipe_class => Pacer::Pipes::EdgesPipe,
    :route_name => 'GraphE'
  Pacer::Route.property_filter(route, filters, block, true)
end

#filter(*args) ⇒ Object



24
25
26
# File 'lib/pacer/core/graph/graph_route.rb', line 24

def filter(*args)
  raise 'Not implemented'
end

#graphObject



38
39
40
41
# File 'lib/pacer/core/graph/graph_route.rb', line 38

def graph
  # This must be defined here to overwrite the #graph method in Route.
  self
end

#hide_elementsObject

Don’t try to inspect the graph data when inspecting.



48
49
50
# File 'lib/pacer/core/graph/graph_route.rb', line 48

def hide_elements
  true
end

#resultObject

Specialization of result simply returns self.



29
30
31
# File 'lib/pacer/core/graph/graph_route.rb', line 29

def result
  self
end

#root?Boolean

The graph itself is as root as you can get.

Returns:

  • (Boolean)


34
35
36
# File 'lib/pacer/core/graph/graph_route.rb', line 34

def root?
  true
end

#v(*filters, &block) ⇒ Object

Returns a new route to all graph vertices. Standard filter options.



7
8
9
10
11
12
13
# File 'lib/pacer/core/graph/graph_route.rb', line 7

def v(*filters, &block)
  filters = Pacer::Route.filters(self, filters)
  route = chain_route :element_type => :vertex,
    :pipe_class => Pacer::Pipes::VerticesPipe,
    :route_name => 'GraphV'
  Pacer::Route.property_filter(route, filters, block, true)
end