123456789_123456789_123456789_123456789_123456789_

Class: NilClass

Relationships & Source Files
Inherits: Object
Defined in: ext/bigdecimal/lib/bigdecimal/util.rb

Instance Method Summary

Instance Method Details

#to_dbigdecimal

Returns nil represented as a ::BigDecimal.

require 'bigdecimal'
require 'bigdecimal/util'

nil.to_d   # => 0.0
[ GitHub ]

  
# File 'ext/bigdecimal/lib/bigdecimal/util.rb', line 182

def to_d
  BigDecimal(0)
end