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.
28
29
30
31
|
# File 'lib/conversion_test.rb', line 28
def initialize(amount, currency=:euro)
self.amount = amount
self.currency = currency
end
|
Instance Method Details
#==(other) ⇒ Object
33
|
# File 'lib/conversion_test.rb', line 33
def ==(other) currency == other.currency && (amount - other.amount).abs/[amount.abs, other.amount.abs].max < 1e-10 end
|
32
|
# File 'lib/conversion_test.rb', line 32
def to_f() amount.to_f end
|
34
|
# File 'lib/conversion_test.rb', line 34
def to_s() amount.to_s end
|