Sha256: e5028a01026c133efe33f55e0f96157c8dae3006b12dad1182948443269f4400

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

module Pacer
  module Routes
    # TODO: this should only apply to ID routes...do we want to be that granular with route types?
    module RouteOperations
      # args is (optional) extensions followed by an (optional) options hash
      def lookup_ids(*args)
        if args.last.is_a? Hash
          opts = args.pop
        else
          opts = {}
        end
        chain_route({transform: :lookup_ids, element_type: :vertex, extensions: args, wrapper: nil}.merge(opts))
      end
    end
  end

  module Transform
    module LookupIds
      import com.tinkerpop.gremlin.pipes.transform.IdVertexPipe
      import com.tinkerpop.gremlin.pipes.transform.IdEdgePipe

      def attach_pipe(end_pipe)
        fail ClientError, 'Can not look up elements without the graph' unless graph
        if element_type == :vertex
          pipe = IdVertexPipe.new graph.blueprints_graph
        elsif element_type == :vertex
          pipe = IdEdgePipe.new graph.blueprints_graph
        else
          fail ClientError, 'Can not look up elements without the element_type'
        end
        pipe.setStarts end_pipe
        pipe
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pacer-1.4.2-java lib/pacer/transform/lookup_ids.rb
pacer-1.4.1-java lib/pacer/transform/lookup_ids.rb
pacer-1.4.0-java lib/pacer/transform/lookup_ids.rb
pacer-1.3.5-java lib/pacer/transform/lookup_ids.rb
pacer-1.3.4-java lib/pacer/transform/lookup_ids.rb
pacer-1.3.3-java lib/pacer/transform/lookup_ids.rb
pacer-1.3.2-java lib/pacer/transform/lookup_ids.rb
pacer-1.3.1-java lib/pacer/transform/lookup_ids.rb
pacer-1.2.0-java lib/pacer/transform/lookup_ids.rb