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