Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/bigdecimal/util.rb,
sig/big_decimal_util.rbs
Instance Method Summary collapse
-
#to_d ⇒ BigDecimal
Returns the result of interpreting leading characters in `str` as a BigDecimal.
Instance Method Details
#to_d ⇒ BigDecimal
Returns the result of interpreting leading characters in str as a
BigDecimal.
require 'bigdecimal'
require 'bigdecimal/util'
"0.5".to_d # => 0.5e0
"123.45e1".to_d # => 0.12345e4
"45.67 degrees".to_d # => 0.4567e2
See also Kernel.BigDecimal.
72 73 74 |
# File 'lib/bigdecimal/util.rb', line 72 def to_d BigDecimal.interpret_loosely(self) end |