method

save_exception_mode

Importance_1
v2_4_6 - Show latest stable - 0 notes - Class: BigDecimal
save_exception_mode() public

Execute the provided block, but preserve the exception mode

BigDecimal.save_exception_mode do
  BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false)
  BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false)

  BigDecimal.new(BigDecimal('Infinity'))
  BigDecimal.new(BigDecimal('-Infinity'))
  BigDecimal(BigDecimal.new('NaN'))
end

For use with the BigDecimal::EXCEPTION_*

See BigDecimal.mode

Show source
Register or log in to add new notes.