Sha256: 93063f896b19bce24ac567b1c5ec9ebe316254a602b380d1232e9caffa3b1cdc
Contents?: true
Size: 503 Bytes
Versions: 19
Compression:
Stored size: 503 Bytes
Contents
Enumerator = Enumerable::Enumerator unless Object.const_defined? :Enumerator # For 1.8.x unless Enumerator.respond_to?(:produce) require 'backports/tools/arguments' class Enumerator def self.produce(initial = Backports::Undefined) raise ArgumentError, 'no block given' unless block_given? Enumerator.new do |y| val = initial == Backports::Undefined ? yield() : initial loop do y << val val = yield(val) end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems