Class: Boolean
Constant Summary collapse
- BOOLEAN_MAPPING =
{ true => true, 'true' => true, 'TRUE' => true, 'True' => true, 't' => true, 'T' => true, '1' => true, 1 => true, 1.0 => true, false => false, 'false' => false, 'FALSE' => false, 'False' => false, 'f' => false, 'F' => false, '0' => false, 0 => false, 0.0 => false, nil => nil }
Class Method Summary collapse
Class Method Details
.from_mongo(value) ⇒ Object
41 42 43 |
# File 'lib/mongo_mapper/extensions.rb', line 41 def self.from_mongo(value) !!value end |
.to_mongo(value) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/mongo_mapper/extensions.rb', line 33 def self.to_mongo(value) if value.is_a?(Boolean) value else BOOLEAN_MAPPING[value] end end |