Permalink
Browse files

Merge pull request #4471 from semaperepelitsa/enum_sum

Pass a symbol instead of a block in Enumerable#sum
  • Loading branch information...
2 parents 78ef738 + d696f8d commit fce3afa9b264126080489d8c3069b2df71de2769 @tenderlove tenderlove committed Jan 15, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/core_ext/enumerable.rb
@@ -59,7 +59,7 @@ def sum(identity = 0, &block)
if block_given?
map(&block).sum(identity)
else
- inject { |sum, element| sum + element } || identity
+ inject(:+) || identity
end
end

0 comments on commit fce3afa

Please sign in to comment.