Sha256: f869e437ba77f48ca683cf7fd81ad0f3a3b0b7a28855e3e4859af5dac02db2e6
Contents?: true
Size: 771 Bytes
Versions: 1
Compression:
Stored size: 771 Bytes
Contents
module Enumerable # Standard in Ruby 1.9.1. See official documentation[http://ruby-doc.org/core-1.9/classes/Enumerable.html] def each_with_object(memo) return to_enum(:each_with_object, memo) unless block_given? each {|obj| yield obj, memo} memo end unless method_defined? :each_with_object # Standard in Ruby 1.9.1. See official documentation[http://ruby-doc.org/core-1.9/classes/Enumerable.html] if instance_method(:each_with_index).arity.zero? def each_with_index_with_optional_args_and_block(*args) return to_enum(:each_with_index, *args) unless block_given? idx = 0 each(*args) { |o| yield(o, idx); idx += 1 } self end Backports.alias_method_chain self, :each_with_index, :optional_args_and_block end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
backports-3.0.3 | lib/backports/1.9.1/enumerable.rb |