diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-26 15:40:27 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-26 15:40:27 +0000 |
commit | 5ba05758fe549404a5b64fba6418278d16be8cec (patch) | |
tree | 59905f589c7b09d840ade60cbbe97ba60b57169a /ext/bigdecimal/lib | |
parent | a987000bbc62348e49f43e2a4fc5128f9345bb59 (diff) |
* ext/bigdecimal/lib/bigdecimal/util.rb (BigDecimal#to_d): added
for adapting other Numeric subclasses. [ruby-dev:44245]
* test/bigdecimal/test_bigdecimal_util.rb: test for the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/lib')
-rw-r--r-- | ext/bigdecimal/lib/bigdecimal/util.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb index 6e1697be88..6860cfd702 100644 --- a/ext/bigdecimal/lib/bigdecimal/util.rb +++ b/ext/bigdecimal/lib/bigdecimal/util.rb @@ -54,6 +54,14 @@ class BigDecimal < Numeric i + "." + ("0"*(-z)) + f end end + + # call-seq: + # a.to_d -> bigdecimal + # + # Returns self. + def to_d + self + end end class Rational < Numeric |