Class: Transformer::Lazy::Yielder

Inherits:
Object
  • Object
show all
Defined in:
lib/coroutines/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(wrapped) ⇒ Yielder

Returns a new instance of Yielder.



256
257
258
# File 'lib/coroutines/base.rb', line 256

def initialize(wrapped)
  @wrapped = wrapped
end

Instance Method Details

#awaitObject



259
260
261
# File 'lib/coroutines/base.rb', line 259

def await
  @wrapped.await
end

#define_yield(&block) ⇒ Object



263
264
265
266
267
268
# File 'lib/coroutines/base.rb', line 263

def define_yield(&block)
  singleton_class.instance_eval do
    define_method(:yield, &block)
    alias_method :<<, :yield
  end
end