Sha256: 2218cfce438106af64db796fcf2ecb40503eb4c6664c308abb63bdaeaf8c01e7

Contents?: true

Size: 947 Bytes

Versions: 12

Compression:

Stored size: 947 Bytes

Contents

# frozen_string_literal: true

module Grumlin
  class Step < AnonymousStep
    attr_reader :client

    def initialize(pool, name, *args, configuration_steps: [], previous_step: nil, **params)
      super(name, *args, previous_step: previous_step, configuration_steps: configuration_steps, **params)
      @pool = pool
    end

    def next
      to_enum.next
    end

    def hasNext # rubocop:disable Naming/MethodName
      to_enum.peek
      true
    rescue StopIteration
      false
    end

    def to_enum
      @to_enum ||= toList.to_enum
    end

    def toList
      @pool.acquire do |client|
        client.write(bytecode)
      end
    end

    def iterate
      @pool.acquire do |client|
        client.write(bytecode(no_return: true))
      end
    end

    def step(step_name, *args, **params)
      self.class.new(@pool, step_name, *args, previous_step: self, configuration_steps: @configuration_steps, **params)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
grumlin-0.15.6 lib/grumlin/step.rb
grumlin-0.15.4 lib/grumlin/step.rb
grumlin-0.15.3 lib/grumlin/step.rb
grumlin-0.15.2 lib/grumlin/step.rb
grumlin-0.15.1 lib/grumlin/step.rb
grumlin-0.15.0 lib/grumlin/step.rb
grumlin-0.14.5 lib/grumlin/step.rb
grumlin-0.14.4 lib/grumlin/step.rb
grumlin-0.14.3 lib/grumlin/step.rb
grumlin-0.14.2 lib/grumlin/step.rb
grumlin-0.14.1 lib/grumlin/step.rb
grumlin-0.14.0 lib/grumlin/step.rb