module SQLite3ExtendFunction::Functions::Sign
Public Class Methods
call(dp)
click to toggle source
@param [Integer, Float] dp @return [Integer] @raise [SQLite3::SQLException]
# File lib/sqlite3_extend_function/functions/sign.rb, line 11 def call(dp) return if dp.nil? value = Float(dp) (value.zero? && 0) || (value.positive? && 1) || -1 rescue ArgumentError raise SQLite3::SQLException, "invalid input syntax for type double precision: \"#{dp}\"" end