Sha256: 6c136e99c6ab3d26e0e6a9fc251714c88c33dc9ebfdcaa2cab586ee39c0943f1
Contents?: true
Size: 603 Bytes
Versions: 4
Compression:
Stored size: 603 Bytes
Contents
module Stages class Each < Stage def initialize(things = nil, &block) @things = things unless things.nil? @block = block super() end def process if @things process_things else process_inputs end end def process_inputs while !source_empty? v = input v = @block.call(v) if @block v.each do |v| output v end end end def process_things @things = @block.call(@things) if @block @things.each do |thing| handle_value thing end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
stages-1.0.1 | lib/stages/each.rb |
stages-1.0.0 | lib/stages/each.rb |
stages-0.4.1 | lib/stages/each.rb |
stages-0.4.0 | lib/stages/each.rb |