class Aliyun::Log::Record::TypeCasting::IntegerType
Public Instance Methods
cast(value)
click to toggle source
# File lib/aliyun/log/record/type_casting.rb, line 124 def cast(value) if value == true 1 elsif value == false 0 elsif value.is_a?(String) && value.blank? nil elsif value.is_a?(Float) && !value.finite? nil elsif !value.respond_to?(:to_i) nil else value.to_i end end