rails/rails — pull request #4471 by semaperepelitsa (2012-01-15 03:54:08+00:00)
Title: Pass a symbol instead of a block in Enumerable#sum

This is faster and more concise. At least Ruby 1.8.7 is required which is ok since 3.2.

Benchmark:

```ruby
require "benchmark"

enum = 1..10_000
N = 100
Benchmark.bm do |x|
x.report "inject block" do
N.times do
enum.inject { |sum, n| sum + n }
end
end

x.report "inject symbol" do
N.times do
enum.inject(:+)
end
end
end
```

Result:

```
user system total real
inject block 0.160000 0.000000 0.160000 ( 0.179723)
inject symbol 0.090000 0.000000 0.090000 ( 0.095667)
```