diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-29 14:13:09 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-29 14:13:09 +0000 |
commit | 97f670920285376c581d8bdcc68e47739b0cf388 (patch) | |
tree | be9ebcd740b483ec789db64120bd36e17dd723ca | |
parent | a6799a13fe87eac1c66a9e45646a07d0e0eb98f7 (diff) | |
download | ruby-97f670920285376c581d8bdcc68e47739b0cf388.tar.gz ruby-97f670920285376c581d8bdcc68e47739b0cf388.tar.xz ruby-97f670920285376c581d8bdcc68e47739b0cf388.zip |
moved def_canon.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | lib/mathn.rb | 20 |
2 files changed, 6 insertions, 16 deletions
@@ -1,6 +1,6 @@ Mon Sep 29 22:54:29 2008 Tadayoshi Funaba <tadf@dotrb.org> - * lib/mathn.rb: added String#to_[rc]. + * lib/mathn.rb: added String#to_[rc]. moved def_canon. Mon Sep 29 20:41:19 2008 Tanaka Akira <akr@fsij.org> diff --git a/lib/mathn.rb b/lib/mathn.rb index b8d9f3546..a4a006e2d 100644 --- a/lib/mathn.rb +++ b/lib/mathn.rb @@ -35,10 +35,6 @@ class Object private :canon -end - -class Numeric - class << self def def_canon(*ids) @@ -53,6 +49,8 @@ class Numeric end end + private :def_canon + end end @@ -265,27 +263,19 @@ end class NilClass - def to_r() 0 end - def to_c() 0 end + def_canon :to_r, :to_c end class Integer - def to_r() self end - def to_c() self end + def_canon :to_r, :to_c 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 + def_canon :to_r, :to_c end |