Class: MongoModel::Types::Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/mongomodel/support/types/boolean.rb

Constant Summary collapse

TRUE_VALUES =
[ true, 'true', 't', 'TRUE', 'T', 'yes', 'YES', 'Y', 'y', '1', 1 ]
FALSE_VALUES =
[ false, 'false', 'f', 'FALSE', 'F', 'no', 'NO', 'N', 'n', '0', 0 ]

Instance Method Summary collapse

Methods inherited from Object

#boolean, #from_mongo, #to_mongo, #to_query

Instance Method Details

#cast(value) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/mongomodel/support/types/boolean.rb', line 7

def cast(value)
  if true?(value)
    true
  elsif false?(value)
    false
  end
end