diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-18 12:33:28 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-18 12:33:28 +0000 |
commit | a22ff208e527d2359fb28fe3c652950418a3148f (patch) | |
tree | 1760ea129a3330abe0395d9250052698f44a4173 | |
parent | 54c77120819d7a8844e055dbeaddaf2bb7be487f (diff) | |
download | ruby-a22ff208e527d2359fb28fe3c652950418a3148f.tar.gz |
* numeric.c (int_to_s): Move from flo_to_s.
* numeric.c (Integer#to_s): Move from Fixnum#to_s.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | numeric.c | 11 |
2 files changed, 11 insertions, 6 deletions
@@ -1,3 +1,9 @@ +Fri Mar 18 21:30:00 2016 Kenta Murata <mrkn@mrkn.jp> + + * numeric.c (int_to_s): Move from flo_to_s. + + * numeric.c (Integer#to_s): Move from Fixnum#to_s. + Fri Mar 18 16:22:24 2016 Victor Nawothnig <Victor.Nawothnig@gmail.com> * parse.y (parse_numvar): NTH_REF must be less than a half of @@ -2948,9 +2948,9 @@ rb_fix2str(VALUE x, int base) /* * call-seq: - * fix.to_s(base=10) -> string + * int.to_s(base=10) -> string * - * Returns a string containing the representation of +fix+ radix +base+ + * Returns a string containing the representation of +int+ radix +base+ * (between 2 and 36). * * 12345.to_s #=> "12345" @@ -2962,7 +2962,7 @@ rb_fix2str(VALUE x, int base) * */ static VALUE -fix_to_s(int argc, VALUE *argv, VALUE x) +int_to_s(int argc, VALUE *argv, VALUE x) { int base; @@ -4185,6 +4185,8 @@ Init_Numeric(void) rb_undef_alloc_func(rb_cInteger); rb_undef_method(CLASS_OF(rb_cInteger), "new"); + rb_define_method(rb_cInteger, "to_s", int_to_s, -1); + rb_define_alias(rb_cInteger, "inspect", "to_s"); rb_define_method(rb_cInteger, "integer?", int_int_p, 0); rb_define_method(rb_cInteger, "odd?", int_odd_p, 0); rb_define_method(rb_cInteger, "even?", int_even_p, 0); @@ -4205,9 +4207,6 @@ Init_Numeric(void) rb_cFixnum = rb_define_class("Fixnum", rb_cInteger); - rb_define_method(rb_cFixnum, "to_s", fix_to_s, -1); - rb_define_alias(rb_cFixnum, "inspect", "to_s"); - rb_define_method(rb_cFixnum, "-@", fix_uminus, 0); rb_define_method(rb_cFixnum, "+", fix_plus, 1); rb_define_method(rb_cFixnum, "-", fix_minus, 1); |