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