Sha256: e90a6e430d35ae1fc988792ac9ecf348191362cd168f3a75569c9a14d28802e1

Contents?: true

Size: 540 Bytes

Versions: 6

Compression:

Stored size: 540 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::Parser::Fuzzy.parse(self, currency)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shopify-money-1.2.1 lib/money/core_extensions.rb
shopify-money-1.2.0 lib/money/core_extensions.rb
shopify-money-1.1.2 lib/money/core_extensions.rb
shopify-money-1.1.1 lib/money/core_extensions.rb
shopify-money-1.1.0 lib/money/core_extensions.rb
shopify-money-1.0.2.pre lib/money/core_extensions.rb