Skip to content

Commit 8146336

Browse files
authored
Remove deprecated method BigDecimal#precs (#470)
`BigDecimal#precs` was deprecated in v3.0.0. Next release (v4.0.0) is a good timing for removing it.
1 parent b7e93bf commit 8146336

File tree

2 files changed

+0
-52
lines changed

2 files changed

+0
-52
lines changed

ext/bigdecimal/bigdecimal.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -400,37 +400,6 @@ BigDecimal_double_fig(VALUE self)
400400
return INT2FIX(BIGDECIMAL_DOUBLE_FIGURES);
401401
}
402402

403-
/* call-seq:
404-
* precs -> array
405-
*
406-
* Returns an Array of two Integer values that represent platform-dependent
407-
* internal storage properties.
408-
*
409-
* This method is deprecated and will be removed in the future.
410-
* Instead, use BigDecimal#n_significant_digits for obtaining the number of
411-
* significant digits in scientific notation, and BigDecimal#precision for
412-
* obtaining the number of digits in decimal notation.
413-
*
414-
*/
415-
416-
static VALUE
417-
BigDecimal_prec(VALUE self)
418-
{
419-
BDVALUE v;
420-
VALUE obj;
421-
422-
rb_category_warn(RB_WARN_CATEGORY_DEPRECATED,
423-
"BigDecimal#precs is deprecated and will be removed in the future; "
424-
"use BigDecimal#precision instead.");
425-
426-
v = GetBDValueMust(self);
427-
obj = rb_assoc_new(SIZET2NUM(v.real->Prec*VpBaseFig()),
428-
SIZET2NUM(v.real->MaxPrec*VpBaseFig()));
429-
430-
RB_GC_GUARD(v.bigdecimal);
431-
return obj;
432-
}
433-
434403
static void
435404
VpCountPrecisionAndScale(Real *p, ssize_t *out_precision, ssize_t *out_scale)
436405
{
@@ -3593,7 +3562,6 @@ Init_bigdecimal(void)
35933562
rb_define_const(rb_cBigDecimal, "NAN", BIGDECIMAL_LITERAL(NAN, NaN));
35943563

35953564
/* instance methods */
3596-
rb_define_method(rb_cBigDecimal, "precs", BigDecimal_prec, 0);
35973565
rb_define_method(rb_cBigDecimal, "precision", BigDecimal_precision, 0);
35983566
rb_define_method(rb_cBigDecimal, "scale", BigDecimal_scale, 0);
35993567
rb_define_method(rb_cBigDecimal, "precision_scale", BigDecimal_precision_scale, 0);

test/bigdecimal/test_bigdecimal.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -778,24 +778,6 @@ def test_cmp_data
778778
assert_operator(BigDecimal((2**100).to_s), :==, d)
779779
end
780780

781-
def test_precs_deprecated
782-
assert_warn(/BigDecimal#precs is deprecated and will be removed in the future/) do
783-
Warning[:deprecated] = true if defined?(Warning.[])
784-
BigDecimal("1").precs
785-
end
786-
end
787-
788-
def test_precs
789-
$VERBOSE, verbose = nil, $VERBOSE
790-
a = BigDecimal("1").precs
791-
assert_instance_of(Array, a)
792-
assert_equal(2, a.size)
793-
assert_kind_of(Integer, a[0])
794-
assert_kind_of(Integer, a[1])
795-
ensure
796-
$VERBOSE = verbose
797-
end
798-
799781
def test_hash
800782
a = []
801783
b = BigDecimal("1")
@@ -832,11 +814,9 @@ def test_load_invalid_precision
832814
too_few_precs = BigDecimal._load('100:' + digits_part)
833815
assert_equal(1000, too_few_precs.precision)
834816
assert_equal(n, too_few_precs)
835-
assert_equal(n.precs, too_few_precs.precs)
836817
too_large_precs = BigDecimal._load('999999999999:' + digits_part)
837818
assert_equal(1000, too_large_precs.precision)
838819
assert_equal(n, too_large_precs)
839-
assert_equal(n.precs, too_large_precs.precs)
840820
ensure
841821
$VERBOSE = verbose
842822
end

0 commit comments

Comments
 (0)