ruby-changes:42101
From: mrkn <ko1@a...>
Date: Fri, 18 Mar 2016 21:33:38 +0900 (JST)
Subject: [ruby-changes:42101] mrkn:r54175 (trunk): * numeric.c (int_to_s): Move from flo_to_s.
mrkn 2016-03-18 21:33:28 +0900 (Fri, 18 Mar 2016) New Revision: 54175 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54175 Log: * numeric.c (int_to_s): Move from flo_to_s. * numeric.c (Integer#to_s): Move from Fixnum#to_s. Modified files: trunk/ChangeLog trunk/numeric.c Index: ChangeLog =================================================================== --- ChangeLog (revision 54174) +++ ChangeLog (revision 54175) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Mar 18 21:30:00 2016 Kenta Murata <mrkn@m...> + + * 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@g...> * parse.y (parse_numvar): NTH_REF must be less than a half of Index: numeric.c =================================================================== --- numeric.c (revision 54174) +++ numeric.c (revision 54175) @@ -2948,9 +2948,9 @@ rb_fix2str(VALUE x, int base) https://github.com/ruby/ruby/blob/trunk/numeric.c#L2948 /* * 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) https://github.com/ruby/ruby/blob/trunk/numeric.c#L2962 * */ 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) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4185 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) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4207 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/