diff options
author | Kenta Murata <[email protected]> | 2020-12-19 11:55:46 +0900 |
---|---|---|
committer | Kenta Murata <[email protected]> | 2020-12-19 22:13:58 +0900 |
commit | 654f6fbf19c0ca2e01765a909b4d952b7f0f5baa (patch) | |
tree | 4596101121252a268228a757e62ace9ffb861fa8 /ext/bigdecimal/bigdecimal.c | |
parent | ff9e40811c67b1090966b655f7adc0684fc58abe (diff) |
[bigdecimal] Make BigDecimal#precs deprecated
https://github.com/ruby/bigdecimal/commit/7e80e6e145
https://github.com/ruby/bigdecimal/commit/0ed7846e8c
Diffstat (limited to 'ext/bigdecimal/bigdecimal.c')
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index ef975a01e0..fa00395583 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -355,11 +355,12 @@ BigDecimal_double_fig(VALUE self) /* call-seq: * big_decimal.precs -> array * - * Returns an Array of two Integer values. + * Returns an Array of two Integer values that represent platform-dependent + * internal storage properties. * - * The first value is the current number of significant digits in the - * BigDecimal. The second value is the maximum number of significant digits - * for the BigDecimal. + * This method is deprecated and will be removed in the future. + * Instead, use BigDecimal#precision for obtaining the number of decimal + * digits. * * BigDecimal('5').precs #=> [9, 18] */ @@ -371,6 +372,10 @@ BigDecimal_prec(VALUE self) Real *p; VALUE obj; + rb_category_warn(RB_WARN_CATEGORY_DEPRECATED, + "BigDecimal#precs is deprecated and will be removed in the future; " + "use BigDecimal#precision instead."); + GUARD_OBJ(p, GetVpValue(self, 1)); obj = rb_assoc_new(SIZET2NUM(p->Prec*VpBaseFig()), SIZET2NUM(p->MaxPrec*VpBaseFig())); |