Sha256: db22a86c0b8d3c9304db8e87cd110b07cb5b36f9d9e4cd8429e64c31843a0b7f

Contents?: true

Size: 368 Bytes

Versions: 55

Compression:

Stored size: 368 Bytes

Contents

module Enumerable
  # Standard in rails... See official documentation[http://api.rubyonrails.org/classes/Enumerable.html]
  # Modified from rails 2.3 to not rely on size
  def sum(identity = 0, &block)
    if block_given?
      map(&block).sum(identity)
    else
      inject { |sum, element| sum + element } || identity
    end
  end unless method_defined? :sum

end

Version data entries

55 entries across 55 versions & 5 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/backports-3.12.0/lib/backports/rails/enumerable.rb
backports-3.16.0 lib/backports/rails/enumerable.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/backports-3.15.0/lib/backports/rails/enumerable.rb
backports-3.15.0 lib/backports/rails/enumerable.rb
backports-3.14.0 lib/backports/rails/enumerable.rb
backports-3.13.0 lib/backports/rails/enumerable.rb
backports-3.12.0 lib/backports/rails/enumerable.rb
backports-3.11.4 lib/backports/rails/enumerable.rb
backports-3.11.3 lib/backports/rails/enumerable.rb
backports-3.11.2 lib/backports/rails/enumerable.rb
backports-3.11.1 lib/backports/rails/enumerable.rb
backports-3.11.0 lib/backports/rails/enumerable.rb
backports-3.10.3 lib/backports/rails/enumerable.rb
backports-3.10.2 lib/backports/rails/enumerable.rb
backports-3.10.1 lib/backports/rails/enumerable.rb
backports-3.10.0 lib/backports/rails/enumerable.rb
backports-3.9.1 lib/backports/rails/enumerable.rb
backports-3.9.0 lib/backports/rails/enumerable.rb
backports-3.8.0 lib/backports/rails/enumerable.rb
backports-3.7.0 lib/backports/rails/enumerable.rb