class String

Public Instance Methods

to_money(currency = nil) click to toggle source

Converts this string to a float and then to a Money object in the default currency. It multiplies the converted numeric value by 100 and treats that as cents.

NOTE!!! This is overriden as per the default Money .to_money because it assumes a different default currency…

‘100’.to_money =>

# File lib/money_extensions/string.rb, line 13
def to_money(currency = nil)
  Money.new((to_f * 100).round, currency)
end