diff options
-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 b8d9f35465..a4a006e2d6 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 |