We’re using the Ruby Money gem. It works great.
We now have a new requirement to round the converted currency amount to whole dollar (without
the pennies).
I have found Ruby’s round method for Fixnum
190.round(-1) returns 200
149.round(-1) returns 100
which is what I want.
I see that Money::Bank::VariableExchange class supports a rounding_method.
I can get a handle to the bank object by calling
Money.default_bank
but how do I register or assign the rounding method to the Money.default_bank object?
Thank you!
Since you want to use the Bank VariableExchange:
Will set your default bank to use the VariableExchange, and round exchanges to the nearest dollar.