module Sequel::LooserTypecasting

Private Instance Methods

_typecast_value_string_to_decimal(value) click to toggle source
# File lib/sequel/extensions/looser_typecasting.rb, line 37
def _typecast_value_string_to_decimal(value)
  BigDecimal(value)
rescue
  BigDecimal('0.0')
end
typecast_value_float(value) click to toggle source

Typecast the value to a Float using to_f instead of Kernel.Float

# File lib/sequel/extensions/looser_typecasting.rb, line 22
def typecast_value_float(value)
  value.to_f
end
typecast_value_integer(value) click to toggle source

Typecast the value to an Integer using to_i instead of Kernel.Integer

# File lib/sequel/extensions/looser_typecasting.rb, line 27
def typecast_value_integer(value)
  value.to_i
end
typecast_value_string(value) click to toggle source

Typecast the value to an String using to_s instead of Kernel.String

# File lib/sequel/extensions/looser_typecasting.rb, line 32
def typecast_value_string(value)
  value.to_s
end