Ruby Generator Functions

EditRocket provides the following information on Generator functions in the Ruby source code builder.

current() - Returns the element at the current position.

each() - Rewinds the generator and enumerates the elements.

end?() - Returns true if the generator has reached the end.

index() - Returns the current index (position) counting from zero.

new(enum = nil, &block) - Creates a new generator either from an Enumerable object or from a block.

next?() - Returns true if the generator has not reached the end yet.

next() - Returns the element at the current position and moves forward.

pos() - Returns the current index (position) counting from zero.

rewind() - Rewinds the generator.

yield(value) - Yields an element to the generator.