зеркало из https://github.com/github/ruby.git
* lib/mathn.rb: added String#to_[rc].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d2ef66df13
Коммит
79b73a7b31
|
@ -1,3 +1,7 @@
|
|||
Mon Sep 29 22:54:29 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* lib/mathn.rb: added String#to_[rc].
|
||||
|
||||
Mon Sep 29 20:41:19 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* string.c (rb_str_subseq): use rb_str_drop_bytes if possible.
|
||||
|
|
20
lib/mathn.rb
20
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])
|
||||
|
|
Загрузка…
Ссылка в новой задаче