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 33 33: def typecast_value_decimal(value) 34: if value.is_a?(String) 35: BigDecimal.new(value) 36: else 37: super 38: end 39: end
Typecast the value to a Float using to_f instead of Kernel.Float
# File lib/sequel/extensions/looser_typecasting.rb, line 17 17: def typecast_value_float(value) 18: value.to_f 19: end
Typecast the value to an Integer using to_i instead of Kernel.Integer
# File lib/sequel/extensions/looser_typecasting.rb, line 22 22: def typecast_value_integer(value) 23: value.to_i 24: end