Class: Enumerable::Enumerator

### Home Classes Methods

### In Files

- lib/backports/1.8.7/enumerator/next.rb
- lib/backports/1.8.7/enumerator/rewind.rb
- lib/backports/1.8.7/enumerator/with_index.rb

### Parent

Object

### Methods

- #next
- #rewind
- #with_index

### Class/Module Index

Quicksearch

- Prime
- Prime::EratosthenesGenerator
- Prime::EratosthenesSieve
- Prime::Generator23
- Prime::OldCompatibility
- Prime::PseudoPrimeGenerator
- Prime::TrialDivision
- Prime::TrialDivisionGenerator
- Backports
- Backports::MOST_EXTREME_OBJECT_EVER
- Backports::Random
- Backports::Random::Implementation
- Backports::Random::MT19937
- Backports::StdLib
- Backports::StdLib::LoadedFeatures
- Enumerator
- Enumerator::GeneratorBP
- Enumerator::Lazy
- Enumerator::Yielder
- Matrix
- Matrix::EigenvalueDecomposition
- Matrix::LUPDecomposition
- Enumerable
- Enumerable::Enumerator
- File
- File::Constants
- ARGF
- Array
- BasicObject
- Bignum
- Binding
- Complex
- Dir
- ENV
- Fixnum
- Float
- GC
- Hash
- IO
- Integer
- Kernel
- Math
- Method
- Module
- NilClass
- Numeric
- Object
- ObjectSpace
- OpenStruct
- Proc
- Process
- Random
- Range
- Regexp
- Set
- StopIteration
- String
- Struct
- Symbol
- UnboundMethod

No matching classes.

# Enumerable::Enumerator

### Public Instance Methods

next() click to toggle source

    # File lib/backports/1.8.7/enumerator/next.rb, line 7
    def next
      require 'generator'
      @generator ||= ::Generator.new(self)
      raise StopIteration unless @generator.next?
      @generator.next
    end

rewind() click to toggle source

    # File lib/backports/1.8.7/enumerator/rewind.rb, line 5
    def rewind
      require 'generator'
      @generator ||= ::Generator.new(self)
      @generator.rewind
      self
    end

with_index(offset = 0) click to toggle source

    # File lib/backports/1.8.7/enumerator/with_index.rb, line 5
    def with_index(offset = 0)
      return to_enum(:with_index, offset) unless block_given?
      each do |*args|
        yield args.size == 1 ? args[0] : args, offset
        offset += 1
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.