Class: Money
Overview
Constant Summary
Conversion::Accessors::ACCESSOR_OPTIONS
Instance Method Summary
collapse
append_features
Constructor Details
#initialize(amount, currency = :euro) ⇒ Money
Returns a new instance of Money.
29
30
31
32
|
# File 'lib/conversion_test.rb', line 29
def initialize(amount, currency=:euro)
self.amount = amount
self.currency = currency
end
|
Instance Method Details
#==(other) ⇒ Object
34
|
# File 'lib/conversion_test.rb', line 34
def ==(other) currency == other.currency && (amount - other.amount).abs/[amount.abs, other.amount.abs].max < 1e-10 end
|
33
|
# File 'lib/conversion_test.rb', line 33
def to_f() amount.to_f end
|
35
|
# File 'lib/conversion_test.rb', line 35
def to_s() amount.to_s end
|