Module: Mongoid::Extensions::Boolean::Conversions
- Included in:
- Boolean
- Defined in:
- lib/mongoid/extensions/boolean/conversions.rb
Overview
:nodoc:
Constant Summary collapse
- BOOLEAN_MAP =
{ true => true, "true" => true, "TRUE" => true, "1" => true, 1 => true, 1.0 => true, false => false, "false" => false, "FALSE" => false, "0" => false, 0 => false, 0.0 => false }
Instance Method Summary collapse
Instance Method Details
#get(value) ⇒ Object
16 17 18 |
# File 'lib/mongoid/extensions/boolean/conversions.rb', line 16 def get(value) value end |
#set(value) ⇒ Object
12 13 14 15 |
# File 'lib/mongoid/extensions/boolean/conversions.rb', line 12 def set(value) value = BOOLEAN_MAP[value] value.nil? ? nil : value end |