Sha256: e6474bbfe169baef062963fe4214b224bec71dd91bfd1776df3eaa55676d1ba2

Contents?: true

Size: 525 Bytes

Versions: 11

Compression:

Stored size: 525 Bytes

Contents

# frozen_string_literal: true
# Allows Writing of 100.to_money for +Numeric+ types
#   100.to_money => #<Money @cents=10000>
#   100.37.to_money => #<Money @cents=10037>
class Numeric
  def to_money(currency = nil)
    Money.new(self, currency)
  end
end

# Allows Writing of '100'.to_money for +String+ types
# Excess characters will be discarded
#   '100'.to_money => #<Money @cents=10000>
#   '100.37'.to_money => #<Money @cents=10037>
class String
  def to_money(currency = nil)
    Money.parse(self, currency)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
shopify-money-1.0.1.pre lib/money/core_extensions.rb
shopify-money-1.0.0.pre lib/money/core_extensions.rb
shopify-money-0.16.0 lib/money/core_extensions.rb
shopify-money-0.15.0 lib/money/core_extensions.rb
shopify-money-0.14.8 lib/money/core_extensions.rb
shopify-money-0.14.7 lib/money/core_extensions.rb
shopify-money-0.14.6 lib/money/core_extensions.rb
shopify-money-0.14.5 lib/money/core_extensions.rb
shopify-money-0.14.4 lib/money/core_extensions.rb
shopify-money-0.14.3 lib/money/core_extensions.rb
shopify-money-0.14.2 lib/money/core_extensions.rb