Sha256: d24fdd4b358932d29eb9a3dffb8a2e8314f5be8832a9e8ecb27440b8be2e2f0d

Contents?: true

Size: 516 Bytes

Versions: 1

Compression:

Stored size: 516 Bytes

Contents

module Stages
  class SubStage < Stage    
    def initialize(pipeline)
      @pipeline = pipeline
      @cache = []
      @with_hash = false
      super()
    end
    
    def with_hash
      @with_hash = true
      self
    end
    
    def process
      while value = input
        subpipe = Emit.new(value) | @pipeline
        while v = subpipe.run
          v = { value => v} if @with_hash
          output v
        end
        @pipeline.drop_leftmost!
        @pipeline.continue
      end
    end
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stages-0.1.2 lib/stages/sub_stage.rb