Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/money/core_extensions.rb

Overview

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>

Instance Method Summary collapse

Instance Method Details

#to_money(currency = nil) ⇒ Object



17
18
19
20
# File 'lib/money/core_extensions.rb', line 17

def to_money(currency = nil)
  currency = Money::Helpers.value_to_currency(currency)
  Money.new(self, currency)
end