class Sink::InputReduceWrapper
Public Class Methods
new(target, initial=nil, &block)
click to toggle source
# File lib/coroutines/sink.rb, line 131 def initialize(target, initial=nil, &block) @target = target; @block = block @memo = initial end
Public Instance Methods
<<(arg)
click to toggle source
# File lib/coroutines/sink.rb, line 135 def <<(arg) if @memo.nil? @memo = arg else @memo = @block.call(@memo, arg) end self end
close()
click to toggle source
# File lib/coroutines/sink.rb, line 143 def close @target << @memo @target.close end