Sha256: b9949ae8a2d1403c7f140755e2cdc438cd93c737760a74ca970d0d3f6a77a169

Contents?: true

Size: 674 Bytes

Versions: 6

Compression:

Stored size: 674 Bytes

Contents

# frozen_string_literal: true

module Grumlin
  class Step < AnonymousStep
    attr_reader :client

    def initialize(pool, name, *args, previous_steps: [])
      super(name, *args, previous_steps: previous_steps)
      @pool = pool
    end

    def next
      @enum ||= toList.to_enum
      @enum.next
    end

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

    def iterate
      @pool.acquire do |client|
        client.write(*(steps + [nil]))
      end
    end

    private

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
grumlin-0.7.0 lib/grumlin/step.rb
grumlin-0.6.2 lib/grumlin/step.rb
grumlin-0.6.1 lib/grumlin/step.rb
grumlin-0.6.0 lib/grumlin/step.rb
grumlin-0.5.1 lib/grumlin/step.rb
grumlin-0.5.0 lib/grumlin/step.rb