Parent

Methods

Enumerator::Yielder

A simple class which allows the construction of Enumerator from a block

Attributes

backports_memo[RW]

Current API for Lazy Enumerator does not provide an easy way to handle internal state. We "cheat" and use yielder to hold it for us. A new yielder is created when generating or after a `rewind`. This way we avoid issues like bugs.ruby-lang.org/issues/7691 or bugs.ruby-lang.org/issues/7696

Public Class Methods

new(&block) click to toggle source
# File lib/backports/1.9.1/enumerator.rb, line 9
def initialize(&block)
  @main_block = block
end

Public Instance Methods

<<(*arg) click to toggle source
# File lib/backports/1.9.1/enumerator.rb, line 22
def <<(*arg)
  @final_block.yield(*arg)
  self
end
each(&block) click to toggle source
# File lib/backports/1.9.1/enumerator.rb, line 13
def each(&block)
  @final_block = block
  @main_block.call(self)
end
yield(*arg) click to toggle source
# File lib/backports/1.9.1/enumerator.rb, line 18
def yield(*arg)
  @final_block.yield(*arg)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.