module Sequel::LooserTypecasting

Private Instance Methods

_typecast_value_string_to_decimal(value) click to toggle source
# File lib/sequel/extensions/looser_typecasting.rb, line 38
def _typecast_value_string_to_decimal(value)
  BigDecimal.new(value)
rescue
  BigDecimal.new('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 23
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 28
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 33
def typecast_value_string(value)
  value.to_s
end