Skip to content

Commit

Permalink
adding to_d to BigDecimal
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jan 10, 2011
1 parent e1a064a commit 2cb497b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Expand Up @@ -18,6 +18,10 @@ def to_yaml(opts = {})
end
end

def to_d
self
end

DEFAULT_STRING_FORMAT = 'F'
def to_formatted_s(format = DEFAULT_STRING_FORMAT)
_original_to_s(format)
Expand Down
Expand Up @@ -7,4 +7,9 @@ def test_to_yaml
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

0 comments on commit 2cb497b

Please sign in to comment.