Sha256: 7ad1cc52ec467e979ecf8f0302871fb573c4516522c7edb78c6ee79360946b5f

Contents?: true

Size: 1.34 KB

Versions: 9

Compression:

Stored size: 1.34 KB

Contents

module Pacer::Core::Graph

  # This module adds route methods to the basic graph classes returned from the
  # blueprints library.
  module GraphRoute
    # Returns a new route to all graph vertices. Standard filter options.
    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

    # Returns a new route to all graph edges. Standard filter options.
    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

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

    # Specialization of result simply returns self.
    def result
      self
    end

    # The graph itself is as root as you can get.
    def root?
      true
    end

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

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

    # Don't try to inspect the graph data when inspecting.
    def hide_elements
      true
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pacer-2.0.24-java lib/pacer/core/graph/graph_route.rb
pacer-2.0.22-java lib/pacer/core/graph/graph_route.rb
pacer-2.0.20-java lib/pacer/core/graph/graph_route.rb
pacer-2.0.19-java lib/pacer/core/graph/graph_route.rb
pacer-2.0.18-java lib/pacer/core/graph/graph_route.rb
pacer-2.0.17-java lib/pacer/core/graph/graph_route.rb
pacer-2.0.16-java lib/pacer/core/graph/graph_route.rb
pacer-2.0.15-java lib/pacer/core/graph/graph_route.rb
pacer-2.0.14-java lib/pacer/core/graph/graph_route.rb