| Class | Enumerable::Enumerator |
| In: |
enumerator.c
|
| Parent: | Object |
A class which provides a method `each’ to be used as an Enumerable object.
Creates a new Enumerable::Enumerator object, which is to be used as an Enumerable object using the given object‘s given method with the given arguments.
Use of this method is not discouraged. Use Kernel#enum_for() instead.
Iterates the given block using the object and the method specified in the first place. If no block is given, returns self.
Iterates the given block for each elements with an index, which start from 0. If no block is given, returns an enumerator.
Returns the next object in the enumerator, and move the internal position forward. When the position reached at the end, internal position is rewinded then StopIteration is raised.
Note that enumeration sequence by next method does not affect other non-external enumeration methods, unless underlying iteration methods itself has side-effect, e.g. IO#each_line.
Iterates the given block for each elements with an index, which start from 0. If no block is given, returns an enumerator.
ruby-doc.org is hosted and run by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. Ruby-doc.org was created in 2002 to promote the Ruby language and to help other Ruby hackers.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.