Sha256: 3210ab048e45ceff56da1483714a0092b47bbf0fa7c29210c659cf533ecd9720

Contents?: true

Size: 172 Bytes

Versions: 6

Compression:

Stored size: 172 Bytes

Contents

# frozen_string_literal: true

class Array
  # Returns sum as a money - and returns 0 for empty arrays
  def total_money
    empty? ? ::Money.new(0) : inject(:+)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
money_extensions-1.5.0 lib/money_extensions/array.rb
money_extensions-1.4.0 lib/money_extensions/array.rb
money_extensions-1.3.0 lib/money_extensions/array.rb
money_extensions-1.2.0 lib/money_extensions/array.rb
money_extensions-1.1.0 lib/money_extensions/array.rb
money_extensions-1.0.0 lib/money_extensions/array.rb