class Shale::Type::Float
Cast value to Float
@api public
Public Class Methods
cast(value)
click to toggle source
@param [#to_f, String
, nil] value Value to cast
@return [Float, nil]
@api private
# File lib/shale/type/float.rb, line 16 def self.cast(value) return if value.nil? case value when ::Float then value when 'Infinity' then ::Float::INFINITY when '-Infinity' then -::Float::INFINITY when 'NaN' then ::Float::NAN else value.to_f end end