save_exception_mode

BigDecimal.save_exception_mode { ... }
Class Public methods

Excecute 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 ::mode

doc_ruby_on_rails
2015-03-31 05:43:45
Comments
Leave a Comment

Please login to continue.