summaryrefslogtreecommitdiffstats
path: root/rational.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-16 23:17:17 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-16 23:17:17 +0000
commit19e547ea39df78ccb779bece37215309a2555838 (patch)
treec03667f6ee8f999e8a60b23453e7b12e043c9880 /rational.c
parentc2b2aa8b27101fa76be45debfc6a96b9a58dab23 (diff)
downloadruby-19e547ea39df78ccb779bece37215309a2555838.tar.gz
ruby-19e547ea39df78ccb779bece37215309a2555838.tar.xz
ruby-19e547ea39df78ccb779bece37215309a2555838.zip
* complex.c (nucomp_coerce): accepts Complex instances.
* rational.c (nurat_coerce): accepts Rational instances. [ruby-core:23859] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/rational.c b/rational.c
index b5c93caa6..3fb0b2a04 100644
--- a/rational.c
+++ b/rational.c
@@ -900,6 +900,8 @@ nurat_coerce(VALUE self, VALUE other)
return rb_assoc_new(f_rational_new_bang1(CLASS_OF(self), other), self);
case T_FLOAT:
return rb_assoc_new(other, f_to_f(self));
+ case T_RATIONAL:
+ return rb_assoc_new(other, self);
}
rb_raise(rb_eTypeError, "%s can't be coerced into %s",