Sha256: 709a1c0e2616827043b7e37d1c817e21de00f81ee4d71f291870d7e0a93d8b8b

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

# frozen_string_literal: true

module Grumlin
  class Traversal
    # TODO: add other start steps
    SUPPORTED_STEPS = %i[E V addE addV].freeze

    CONFIGURATION_STEPS = %i[withSideEffect].freeze

    attr_reader :configuration_steps

    def initialize(pool = Grumlin.default_pool, configuration_steps: [])
      @pool = pool
      @configuration_steps = configuration_steps
    end

    alias inspect to_s

    CONFIGURATION_STEPS.each do |step|
      define_method step do |*args, **params|
        self.class.new(@pool, configuration_steps: @configuration_steps + [AnonymousStep.new(step, *args, **params)])
      end
    end

    SUPPORTED_STEPS.each do |step|
      define_method step do |*args, **params|
        Step.new(@pool, step, *args, configuration_steps: @configuration_steps, **params)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
grumlin-0.14.1 lib/grumlin/traversal.rb
grumlin-0.14.0 lib/grumlin/traversal.rb