Sha256: 7e3055f1e7cf322a424a37d38f0f5fb4de10f98f566bfbb323b7a44896281fbe

Contents?: true

Size: 903 Bytes

Versions: 7

Compression:

Stored size: 903 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[withSack withSideEffect].freeze

    attr_reader :configuration_steps

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

    def inspect
      "#<#{self.class}>"
    end

    def to_s
      inspect
    end

    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

7 entries across 7 versions & 1 rubygems

Version Path
grumlin-0.15.3 lib/grumlin/traversal.rb
grumlin-0.15.2 lib/grumlin/traversal.rb
grumlin-0.15.1 lib/grumlin/traversal.rb
grumlin-0.15.0 lib/grumlin/traversal.rb
grumlin-0.14.5 lib/grumlin/traversal.rb
grumlin-0.14.4 lib/grumlin/traversal.rb
grumlin-0.14.3 lib/grumlin/traversal.rb