From 0001260aaf3b69344b626c4a18faac938682cdbe Mon Sep 17 00:00:00 2001 From: tadf Date: Mon, 29 Sep 2008 14:13:09 +0000 Subject: moved def_canon. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/mathn.rb | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3