mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
adding to_d to BigDecimal
This commit is contained in:
@@ -18,6 +18,10 @@ class BigDecimal
|
||||
end
|
||||
end
|
||||
|
||||
def to_d
|
||||
self
|
||||
end
|
||||
|
||||
DEFAULT_STRING_FORMAT = 'F'
|
||||
def to_formatted_s(format = DEFAULT_STRING_FORMAT)
|
||||
_original_to_s(format)
|
||||
|
||||
@@ -7,4 +7,9 @@ class BigDecimalTest < Test::Unit::TestCase
|
||||
assert_equal("--- .NaN\n", BigDecimal.new('NaN').to_yaml)
|
||||
assert_equal("--- -.Inf\n", BigDecimal.new('-Infinity').to_yaml)
|
||||
end
|
||||
end
|
||||
|
||||
def test_to_d
|
||||
bd = BigDecimal.new '10'
|
||||
assert_equal bd, bd.to_d
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user