Class: Enumerator::Yielder

Inherits:
Object show all
Defined in:
lib/core/facets/enumerator.rb

Overview

Wrapper to allow yielder.yield(output) or yielder << output in the same way as ruby-1.9

TODO: Why can't Yielder take a block instead of a proc argument?

Instance Method Summary collapse

Constructor Details

#initialize(&proc) ⇒ Yielder

Returns a new instance of Yielder.


56
57
58
# File 'lib/core/facets/enumerator.rb', line 56

def initialize(&proc)
  @proc = proc
end

Instance Method Details

#yield(*args) ⇒ Object Also known as: <<


59
60
61
# File 'lib/core/facets/enumerator.rb', line 59

def yield(*args)
  @proc[*args]
end