Sha256: c87b07e258b78c42a27e728ddae4eff4c423c388b89ada82736a086204449eb0

Contents?: true

Size: 655 Bytes

Versions: 3

Compression:

Stored size: 655 Bytes

Contents

# frozen_string_literal: true

module Grumlin
  class Step < AnonymousStep
    attr_reader :client

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

    def next
      @enum ||= toList.to_enum
      @enum.next
    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

    private

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grumlin-0.10.0 lib/grumlin/step.rb
grumlin-0.9.0 lib/grumlin/step.rb
grumlin-0.8.0 lib/grumlin/step.rb