Skip to content

Commit 9f75fce

Browse files
committed
Typecast invalid BigDecimal to 0.0 regardless of Ruby version
Fixes a CI failure on Ruby 2.0.0, where a newer BigDecimal gem was used.
1 parent 6ae69b4 commit 9f75fce

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

lib/sequel/extensions/looser_typecasting.rb

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,11 @@ def typecast_value_string(value)
3737
value.to_s
3838
end
3939

40-
if RUBY_VERSION >= '2.4'
41-
def _typecast_value_string_to_decimal(value)
42-
BigDecimal(value)
43-
rescue
44-
BigDecimal('0.0')
45-
end
46-
else
47-
# :nocov:
48-
def _typecast_value_string_to_decimal(value)
49-
BigDecimal(value)
50-
end
51-
# :nocov:
40+
# Typecast invalid BigDecimal to 0.0.
41+
def _typecast_value_string_to_decimal(value)
42+
BigDecimal(value)
43+
rescue
44+
BigDecimal('0.0')
5245
end
5346
end
5447

0 commit comments

Comments
 (0)