diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-29 13:55:39 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-29 13:55:39 +0000 |
commit | a6799a13fe87eac1c66a9e45646a07d0e0eb98f7 (patch) | |
tree | 7949ed224041b0b10f715b01d0bd26dae950972e /lib/mathn.rb | |
parent | c9b47e26a6a6f7d5763fdeb374c130f4f30f39fe (diff) | |
download | ruby-a6799a13fe87eac1c66a9e45646a07d0e0eb98f7.tar.gz ruby-a6799a13fe87eac1c66a9e45646a07d0e0eb98f7.tar.xz ruby-a6799a13fe87eac1c66a9e45646a07d0e0eb98f7.zip |
* lib/mathn.rb: added String#to_[rc].
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/mathn.rb')
-rw-r--r-- | lib/mathn.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/mathn.rb b/lib/mathn.rb index 486d48729..b8d9f3546 100644 --- a/lib/mathn.rb +++ b/lib/mathn.rb @@ -61,6 +61,8 @@ class Fixnum remove_method :/ alias / quo + def_canon *(instance_methods - Object.methods - [:canon]) + alias power! ** def ** (other) @@ -71,14 +73,14 @@ class Fixnum end end - def_canon *(instance_methods - Object.methods - [:canon]) - end class Bignum remove_method :/ alias / quo + def_canon *(instance_methods - Object.methods - [:canon]) + alias power! ** def ** (other) @@ -89,8 +91,6 @@ class Bignum end end - def_canon *(instance_methods - Object.methods - [:canon]) - end alias RationalOrig Rational @@ -277,6 +277,18 @@ class Integer end +class String + + alias to_r_orig to_r + private :to_r_orig + def to_r() to_r_orig.__send__(:canon) end + + alias to_c_orig to_c + private :to_c_orig + def to_c() to_c_orig.__send__(:canon) end + +end + class Float def_canon *(instance_methods - Object.methods - [:canon]) |