Class: Integer

Inherits:
Numeric
  • Object
show all
Defined in:
lib/bigdecimal/util.rb

Overview

bigdecimal/util extends the native Integer class to provide the #to_d method.

When you require ‘bigdecimal/util’ in your application, this method will be available on Integer objects.

Instance Method Summary collapse

Instance Method Details

#to_dObject

call-seq:

int.to_d  -> bigdecimal

Convert int to a BigDecimal and return it.

require 'bigdecimal'
require 'bigdecimal/util'

42.to_d
# => 0.42e2


23
24
25
# File 'lib/bigdecimal/util.rb', line 23

def to_d
  BigDecimal(self)
end