method

new

v1_8_6_287 - Show latest stable - Class: Generator
new(enum = nil, &block)
public

Creates a new generator either from an Enumerable object or from a block.

In the former, block is ignored even if given.

In the latter, the given block is called with the generator itself, and expected to call the yield method for each element.