Sha256: de0ba802b35e8513f3c705232d3f310096a0eb6c8346b2e741fa691c4e7bb4a8

Contents?: true

Size: 763 Bytes

Versions: 29

Compression:

Stored size: 763 Bytes

Contents

require 'enumerator'
if (Enumerable::Enumerator rescue false)
  module Enumerable
    class Enumerator
      # Standard in Ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Enumerator.html]
      Backports.make_block_optional self, :each, :test_on => [42].to_enum

      def next
        require 'generator'
        @generator ||= Generator.new(self)
        raise StopIteration unless @generator.next?
        @generator.next
      end unless method_defined? :next

      def rewind
        @object.rewind if @object.respond_to? :rewind
        require 'generator'
        @generator ||= Generator.new(self)
        @generator.rewind
        self
      end unless method_defined? :rewind
    end if const_defined? :Enumerator
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
backports-2.8.1 lib/backports/1.8.7/enumerator.rb
backports-2.8.0 lib/backports/1.8.7/enumerator.rb
backports-2.7.1 lib/backports/1.8.7/enumerator.rb
backports-2.7.0 lib/backports/1.8.7/enumerator.rb
backports-2.6.7 lib/backports/1.8.7/enumerator.rb
backports-2.6.6 lib/backports/1.8.7/enumerator.rb
backports-2.6.5 lib/backports/1.8.7/enumerator.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/backports-2.6.4/lib/backports/1.8.7/enumerator.rb
backports-2.6.4 lib/backports/1.8.7/enumerator.rb
backports-2.6.3 lib/backports/1.8.7/enumerator.rb
backports-2.6.2 lib/backports/1.8.7/enumerator.rb
backports-2.6.1 lib/backports/1.8.7/enumerator.rb
backports-2.6.0 lib/backports/1.8.7/enumerator.rb
backports-2.5.3 lib/backports/1.8.7/enumerator.rb
backports-2.5.2 lib/backports/1.8.7/enumerator.rb
backports-2.5.1 lib/backports/1.8.7/enumerator.rb
backports-2.5.0 lib/backports/1.8.7/enumerator.rb
backports-2.4.0 lib/backports/1.8.7/enumerator.rb
backports-2.3.0 lib/backports/1.8.7/enumerator.rb
backports-2.2.1 lib/backports/1.8.7/enumerator.rb