aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 12:24:06 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-30 12:24:06 +0000
commitf80386489a8cda0508c09445ac9a0bcc4027f33a (patch)
treea0553fe8d145f2cc83506b36b1ecbf0821c74fc3 /numeric.c
parent8d3ff69d4fef0c79a6b4a71da5a05fa2afce9871 (diff)
downloadruby-f80386489a8cda0508c09445ac9a0bcc4027f33a.tar.gz
Define Integer#+ instead of Bignum#+.
* numeric.c (rb_int_plus): Define Integer#+. * bignum.c (rb_big_plus): Don't define Bignum#+. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index be66fd0685..8214873fc1 100644
--- a/numeric.c
+++ b/numeric.c
@@ -3223,9 +3223,10 @@ rb_int2str(VALUE x, int base)
}
/*
+ * Document-method: Integer#+
* Document-method: Fixnum#+
* call-seq:
- * fix + numeric -> numeric_result
+ * int + numeric -> numeric_result
*
* Performs addition: the class of the resulting object depends on the class of
* +numeric+ and on the magnitude of the result. It may return a Bignum.
@@ -4940,6 +4941,7 @@ Init_Numeric(void)
rb_define_method(rb_cInteger, "-@", rb_int_uminus, 0);
rb_define_method(rb_cFixnum, "+", fix_plus, 1);
+ rb_define_method(rb_cInteger, "+", rb_int_plus, 1);
rb_define_method(rb_cFixnum, "-", fix_minus, 1);
rb_define_method(rb_cInteger, "-", rb_int_minus, 1);
rb_define_method(rb_cFixnum, "*", fix_mul, 1);