Module | Sequel::LooserTypecasting |
In: |
lib/sequel/extensions/looser_typecasting.rb
|
Typecast the value to a BigDecimal, without checking if strings have a valid format.
# File lib/sequel/extensions/looser_typecasting.rb, line 37 37: def typecast_value_decimal(value) 38: if value.is_a?(String) 39: BigDecimal.new(value) 40: else 41: super 42: end 43: end
Typecast the value to a Float using to_f instead of Kernel.Float
# File lib/sequel/extensions/looser_typecasting.rb, line 21 21: def typecast_value_float(value) 22: value.to_f 23: end
Typecast the value to an Integer using to_i instead of Kernel.Integer
# File lib/sequel/extensions/looser_typecasting.rb, line 26 26: def typecast_value_integer(value) 27: value.to_i 28: end