From 2d444cf9f554fff1c027e522e1d85c2192b16486 Mon Sep 17 00:00:00 2001 From: korbin Date: Wed, 13 Mar 2024 15:33:34 -0600 Subject: [PATCH] use BigDecimal#precision instead of BigDecimal#precs when available --- lib/protip/transformers/big_decimal_transformer.rb | 2 +- lib/protip/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/protip/transformers/big_decimal_transformer.rb b/lib/protip/transformers/big_decimal_transformer.rb index 48cea1d..e098f86 100644 --- a/lib/protip/transformers/big_decimal_transformer.rb +++ b/lib/protip/transformers/big_decimal_transformer.rb @@ -21,7 +21,7 @@ def to_message(object, field) field.subtype.msgclass.new( numerator: rational.numerator, denominator: rational.denominator, - precision: object.precs[0], # This is the current precision of the decimal + precision: object.try(:precision) || object.precs[0], # This is the current precision of the decimal ) end end).new diff --git a/lib/protip/version.rb b/lib/protip/version.rb index 701f265..f25e4a7 100644 --- a/lib/protip/version.rb +++ b/lib/protip/version.rb @@ -1,3 +1,3 @@ module Protip - VERSION = '0.37.4' + VERSION = '0.37.5' end