Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/money/core_extensions.rb
Overview
Open String to add new methods.
Instance Method Summary collapse
-
#to_currency ⇒ Money::Currency
Converts the current string into a
Currencyobject. -
#to_money(currency = nil) ⇒ Money
Parses the current string and converts it to a
Moneyobject.
Instance Method Details
#to_currency ⇒ Money::Currency
Converts the current string into a Currency object.
59 60 61 |
# File 'lib/money/core_extensions.rb', line 59 def to_currency Money::Currency.new(self) end |
#to_money(currency = nil) ⇒ Money
Parses the current string and converts it to a Money object. Excess characters will be discarded.
45 46 47 |
# File 'lib/money/core_extensions.rb', line 45 def to_money(currency = nil) Money.parse(self, currency) end |