class ArJdbc::MSSQL::DecimalType
@private
Private Instance Methods
cast_value(value)
click to toggle source
# File lib/arjdbc/mssql/types.rb, line 108 def cast_value(value) return 0 if value.equal? false return 1 if value.equal? true if @scale == 0 # act-like an integer return value.to_i rescue nil end case value when ::Float if precision BigDecimal(value, float_precision) else value.to_d end when ::Numeric, ::String BigDecimal(value, precision.to_i) else if value.respond_to?(:to_d) value.to_d else BigDecimal(value.to_s, precision.to_i) end end end
float_precision()
click to toggle source
# File lib/arjdbc/mssql/types.rb, line 134 def float_precision if precision.to_i > ::Float::DIG + 1 ::Float::DIG + 1 else precision.to_i end end