aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-18 12:33:28 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-18 12:33:28 +0000
commita22ff208e527d2359fb28fe3c652950418a3148f (patch)
tree1760ea129a3330abe0395d9250052698f44a4173 /numeric.c
parent54c77120819d7a8844e055dbeaddaf2bb7be487f (diff)
downloadruby-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
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/numeric.c b/numeric.c
index 32e921a447..b87bb4bf7e 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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);