aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2011-07-23 15:41:55 -0400
committerMarc-Andre Lafortune <github@marc-andre.ca>2011-07-23 15:52:38 -0400
commitf061ffd9f4e7f7d612d4baa25e8075bb23896275 (patch)
treeeffc9947280a8c17c83985bae6eff9bebaa686d0 /activesupport/lib/active_support
parent816abecf90167c4df7d2117188bfa9d19b752696 (diff)
downloadrails-f061ffd9f4e7f7d612d4baa25e8075bb23896275.tar.gz
rails-f061ffd9f4e7f7d612d4baa25e8075bb23896275.tar.bz2
rails-f061ffd9f4e7f7d612d4baa25e8075bb23896275.zip
Trivial optimization for Enumerable#each_with_object
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/enumerable.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb
index f2dd34cc55..ddb4f3012f 100644
--- a/activesupport/lib/active_support/core_ext/enumerable.rb
+++ b/activesupport/lib/active_support/core_ext/enumerable.rb
@@ -76,10 +76,10 @@ module Enumerable
#
# (1..5).each_with_object(1) { |value, memo| memo *= value } # => 1
#
- def each_with_object(memo, &block)
+ def each_with_object(memo)
return to_enum :each_with_object, memo unless block_given?
each do |element|
- block.call(element, memo)
+ yield element, memo
end
memo
end unless [].respond_to?(:each_with_object)