Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/bd_money/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#to_money(precision = nil, round_mode = nil) ⇒ Object

Convert the number to a Money object.

100.to_money      #=> 100.00

Takes an optional precision, which defaults to 2 Takes an optional round_mode which defaults to :half_up



8
9
10
# File 'lib/bd_money/core_extensions.rb', line 8

def to_money(precision = nil, round_mode = nil)
  Money.new self, precision, round_mode
end