Sha256: 99c501e7420739ca3464e86b47aab3835b51a9a6f38b0f75699495659bfb3281
Contents?: true
Size: 697 Bytes
Versions: 17
Compression:
Stored size: 697 Bytes
Contents
module Acfs::Resource::Attributes # @api public # # Float attribute type. Use it in your model as an attribute type: # # @example # class User < Acfs::Resource # attribute :name, :float # end # class Float < Base # @api public # # Cast given object to float. # # @param [Object] value Object to cast. # @return [Float] Casted object as float. # def cast_value(value) return 0.0 if value.blank? case value when ::Float then value when "Infinity" then ::Float::INFINITY when "-Infinity" then -::Float::INFINITY when "NaN" then ::Float::NAN else Float(value) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems