Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/bd_money/core_extensions.rb
Instance Method Summary collapse
-
#to_money(precision = nil, round_mode = nil) ⇒ Object
Convert the float to a
Money
object.
Instance Method Details
#to_money(precision = nil, round_mode = nil) ⇒ Object
Convert the float to a Money
object.
3.75.to_money #=> 3.75
Takes an optional precision, which defaults to 2 Takes an optional round_mode which defaults to :half_up
20 21 22 |
# File 'lib/bd_money/core_extensions.rb', line 20 def to_money(precision = nil, round_mode = nil) Money.new self, precision, round_mode end |