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