module Sequel::LooserTypecasting

Public Instance Methods

typecast_value_decimal(value) click to toggle source

Typecast the value to a BigDecimal, without checking if strings have a valid format.

Calls superclass method
# File lib/sequel/extensions/looser_typecasting.rb, line 33
def typecast_value_decimal(value)
  if value.is_a?(String)
    BigDecimal.new(value)
  else
    super
  end
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 17
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 22
def typecast_value_integer(value)
  value.to_i
end
typecast_value_string(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_string(value)
  value.to_s
end