Class: Enumerator::GeneratorBP

Inherits:
Object
  • Object
show all
Defined in:
lib/backports/1.9.1/enumerator/new.rb

Overview

Avoid conflict with 1.8’s ::Generator class

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ GeneratorBP

Returns a new instance of GeneratorBP.



25
26
27
# File 'lib/backports/1.9.1/enumerator/new.rb', line 25

def initialize(&block)
  @main_block = block
end

Instance Method Details

#each(&block) ⇒ Object



29
30
31
# File 'lib/backports/1.9.1/enumerator/new.rb', line 29

def each(&block)
  @main_block.call(Yielder.new(&block))
end