Module: Mint::Currency::CustomRounding

Defined in:
lib/minting/currency/rounding.rb

Overview

Replaces the default normalization method after custom rounding is first requested, keeping the default path free of dispatch and thread checks.

Instance Method Summary collapse

Instance Method Details

#normalize_amount(amount) ⇒ Object



10
11
12
# File 'lib/minting/currency/rounding.rb', line 10

def normalize_amount(amount)
  amount.to_r.round(subunit, half: Thread.current[Currency::ROUNDING_THREAD_KEY] || :up)
end