Method: Fat::Money#initialize

Defined in:
lib/fat/money.rb

#initialize(string) ⇒ Money

Returns a new instance of Money.



8
9
10
11
12
# File 'lib/fat/money.rb', line 8

def initialize string
  stripped = ''
  string.each {|char| stripped += char if char.between?('0', '9') or char == '.'}
  @cents = (100 * stripped.to_f).to_i
end