Sha256: 06d90b46207d43ad3b13b46782bb29a75f742d1361aac7283e3f8a7be1b550d4
Contents?: true
Size: 458 Bytes
Versions: 12
Compression:
Stored size: 458 Bytes
Contents
module MongoModel module Types class Integer < Object def cast(value) if value.nil? nil else begin Kernel::Integer(value) rescue ArgumentError Kernel::Float(value).to_i rescue nil end end end def boolean(value) !value.zero? end end end end MongoModel::Types.register_converter(Integer, MongoModel::Types::Integer.new)
Version data entries
12 entries across 12 versions & 1 rubygems