RubyMoney/money

Setting #default_infinite_precision on a per-instance level

Closed this issue · 1 comments

23tux commented

My application does not use Money.default_infinite_precision = true per default. However, in some cases I need it to be turned on. I haven't found a way to set it on a per-instance base, e.g.:

> Money.default_infinite_precision
=> false

# the option isn't parsed
> money = Money.new(BigDecimal("0.000248"), Money.default_currency, infinite_precision: true)
=> #<Money fractional:0 currency:EUR>

For now, I have a special sub-class for this, but it would be nice to set it on a per-instance base.

class MoneyInfinitePrecision < Money
  self.default_infinite_precision = true
end

@semmons99 I am running into this issue as well. I can submit a PR, but is there a reason why this was closed as completed? It seems like all of the open issues were closed around the same time in this repo.