summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-15 14:46:35 (GMT)
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-15 14:46:35 (GMT)
commit0a267b79f62aac02628b02d27c716cfa8c2d67dc (patch)
tree0f12bf0c96edf7e7902fd5c8cf3b9dbbf1edcda6 /rational.c
parenta945eb9ddab99357a9f831c5dae99f33f223ac71 (diff)
array.c (rb_ary_sum): use rb_rational_add directly
* rational.c (rb_rational_add): rename from nurat_add. * array.c (rb_ary_sum): use rb_rational_add directly. * test/ruby/test_array.rb (test_sum): add assertions for an array of Rational values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/rational.c b/rational.c
index 65902cd..8624ea1 100644
--- a/rational.c
+++ b/rational.c
@@ -741,8 +741,8 @@ f_addsub(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
* Rational(9, 8) + 4 #=> (41/8)
* Rational(20, 9) + 9.8 #=> 12.022222222222222
*/
-static VALUE
-nurat_add(VALUE self, VALUE other)
+VALUE
+rb_rational_add(VALUE self, VALUE other)
{
if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
{
@@ -2538,7 +2538,7 @@ Init_Rational(void)
rb_define_method(rb_cRational, "numerator", nurat_numerator, 0);
rb_define_method(rb_cRational, "denominator", nurat_denominator, 0);
- rb_define_method(rb_cRational, "+", nurat_add, 1);
+ rb_define_method(rb_cRational, "+", rb_rational_add, 1);
rb_define_method(rb_cRational, "-", nurat_sub, 1);
rb_define_method(rb_cRational, "*", nurat_mul, 1);
rb_define_method(rb_cRational, "/", nurat_div, 1);