Sha256: 35f6abb4b473b2815f473bf472808c904938f131be8997cb2a0c8634acc79493

Contents?: true

Size: 591 Bytes

Versions: 3

Compression:

Stored size: 591 Bytes

Contents

# frozen_string_literal: true

module Grumlin
  class Traversal
    attr_reader :connection

    def initialize(client_or_url, &block)
      @client = if client_or_url.is_a?(String)
                  Grumlin::Client.new(client_or_url)
                else
                  client_or_url
                end

      return if block.nil?

      TraversingContext.new(self).instance_exec(&block)
    end

    %w[addV addE V E].each do |step|
      define_method step do |*args|
        Step.new(@client, step, *args)
      end
    end

    alias addVertex addV
    alias addEdge addE
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grumlin-0.1.3 lib/grumlin/traversal.rb
grumlin-0.1.1 lib/grumlin/traversal.rb
grumlin-0.1.0 lib/grumlin/traversal.rb