Sha256: ff660d9334a5fe7c6278d7ccc5ae4856e705ee834670448d1e058431bb0a269c
Contents?: true
Size: 721 Bytes
Versions: 1
Compression:
Stored size: 721 Bytes
Contents
module Stages class Wrap < Stage def initialize(pipeline) @pipeline = pipeline @cache = [] @output_style = :hash super() end def array @output_style = :array self end def each @output_style = :each self end def process while value = input subpipe = Emit.new(value) | @pipeline results = [] while v = subpipe.run @output_style == :each ? output(v) : results << v end output results if @output_style == :array output({ value => results}) if @output_style == :hash @pipeline.drop_leftmost! @pipeline.continue end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stages-0.2.0 | lib/stages/wrap.rb |