Sha256: 46af8a61b83017c9c0cb5f7b5d719132fe44d398b5271fac08bddde15b43fc85

Contents?: true

Size: 651 Bytes

Versions: 9

Compression:

Stored size: 651 Bytes

Contents

# The LooserTypecasting extension changes the float and integer typecasting to
# use the looser .to_f and .to_i instead of the more strict Kernel.Float and
# Kernel.Integer.  To load the extension into the database:
#
#   DB.extension :looser_typecasting

module Sequel
  module LooserTypecasting
    # Typecast the value to a Float using to_f instead of Kernel.Float
    def typecast_value_float(value)
      value.to_f
    end

    # Typecast the value to an Integer using to_i instead of Kernel.Integer
    def typecast_value_integer(value)
      value.to_i
    end
  end

  Database.register_extension(:looser_typecasting, LooserTypecasting)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sequel-3.45.0 lib/sequel/extensions/looser_typecasting.rb
sequel-3.44.0 lib/sequel/extensions/looser_typecasting.rb
sequel-3.43.0 lib/sequel/extensions/looser_typecasting.rb
sequel-3.42.0 lib/sequel/extensions/looser_typecasting.rb
sequel-3.41.0 lib/sequel/extensions/looser_typecasting.rb
sequel-3.40.0 lib/sequel/extensions/looser_typecasting.rb
sequel-3.39.0 lib/sequel/extensions/looser_typecasting.rb
sequel-3.38.0 lib/sequel/extensions/looser_typecasting.rb
sequel-3.37.0 lib/sequel/extensions/looser_typecasting.rb