aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-21 01:29:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-21 01:29:57 +0000
commita6289135e9cc584389e9d5b17333c2f4bfa26d21 (patch)
tree7de085299269a93eb8369692af9b972a741d8752 /numeric.c
parentbaade520f54e8d039846a331164bb639a6d0838f (diff)
downloadruby-a6289135e9cc584389e9d5b17333c2f4bfa26d21.tar.gz
numeric.c: allow nil as rounding mode option
* numeric.c (rb_num_get_rounding_option): allow nil same as the default behavior, per [ruby-core:77961]. [Bug #12548] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/numeric.c b/numeric.c
index 17d15f6c92..dabcdc39de 100644
--- a/numeric.c
+++ b/numeric.c
@@ -209,6 +209,9 @@ rb_num_get_rounding_option(VALUE opts)
if (SYMBOL_P(rounding)) {
str = rb_sym2str(rounding);
}
+ else if (NIL_P(rounding)) {
+ goto noopt;
+ }
else if (!RB_TYPE_P(str = rounding, T_STRING)) {
str = rb_check_string_type(rounding);
if (NIL_P(str)) goto invalid;