Sha256: 5d107fc9f73022ca3e64a4e18f96d6ecefd6ae9115fbaa6faadf4cc1d8894593
Contents?: true
Size: 529 Bytes
Versions: 12
Compression:
Stored size: 529 Bytes
Contents
module MongoModel module Types class Boolean < Object TRUE_VALUES = [ true, 'true', 't', 'TRUE', 'T', 'YES', 'y', '1', 1 ] FALSE_VALUES = [ false, 'false', 'f', 'FALSE', 'F', 'NO', 'n', '0', 0 ] def cast(value) if true?(value) true elsif false?(value) false end end private def true?(value) TRUE_VALUES.include?(value) end def false?(value) FALSE_VALUES.include?(value) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems