Sha256: a1d2571cdb79f6f508e8115922362ee7a1b4b81f0ddb0fd1f293217742ecc643

Contents?: true

Size: 1.1 KB

Versions: 11

Compression:

Stored size: 1.1 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.pipes.transform.IdVertexPipe
      import com.tinkerpop.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

11 entries across 11 versions & 1 rubygems

Version Path
pacer-2.0.10-java lib/pacer/transform/lookup_ids.rb
pacer-2.0.10.pre-java lib/pacer/transform/lookup_ids.rb
pacer-2.0.8-java lib/pacer/transform/lookup_ids.rb
pacer-2.0.6-java lib/pacer/transform/lookup_ids.rb
pacer-2.0.4.pre-java lib/pacer/transform/lookup_ids.rb
pacer-2.0.0.pre-java lib/pacer/transform/lookup_ids.rb
pacer-1.6.0-java lib/pacer/transform/lookup_ids.rb
pacer-1.5.4-java lib/pacer/transform/lookup_ids.rb
pacer-1.5.3-java lib/pacer/transform/lookup_ids.rb
pacer-1.5.2-java lib/pacer/transform/lookup_ids.rb
pacer-1.5.1-java lib/pacer/transform/lookup_ids.rb