Sha256: 47bcfc8ccd272b451eb4904698410a351521d25e37bbb924cbe5e5f44c3b28d2
Contents?: true
Size: 609 Bytes
Versions: 4
Compression:
Stored size: 609 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| handle_value 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.2.1 | lib/stages/each.rb |
stages-1.2.0 | lib/stages/each.rb |
stages-1.1.5 | lib/stages/each.rb |
stages-1.1.2 | lib/stages/each.rb |