mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
moved def_canon.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
79b73a7b31
commit
0001260aaf
2 changed files with 6 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
||||||
Mon Sep 29 22:54:29 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
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>
|
Mon Sep 29 20:41:19 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
|
20
lib/mathn.rb
20
lib/mathn.rb
|
@ -35,10 +35,6 @@ class Object
|
||||||
|
|
||||||
private :canon
|
private :canon
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
class Numeric
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
||||||
def def_canon(*ids)
|
def def_canon(*ids)
|
||||||
|
@ -53,6 +49,8 @@ class Numeric
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private :def_canon
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -265,27 +263,19 @@ end
|
||||||
|
|
||||||
class NilClass
|
class NilClass
|
||||||
|
|
||||||
def to_r() 0 end
|
def_canon :to_r, :to_c
|
||||||
def to_c() 0 end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Integer
|
class Integer
|
||||||
|
|
||||||
def to_r() self end
|
def_canon :to_r, :to_c
|
||||||
def to_c() self end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class String
|
class String
|
||||||
|
|
||||||
alias to_r_orig to_r
|
def_canon :to_r, :to_c
|
||||||
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
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue