Class: Mongomatic::TypeConverters::Bool
- Inherits:
-
Base
- Object
- Base
- Mongomatic::TypeConverters::Bool
show all
- Defined in:
- lib/mongomatic/type_converters.rb
Instance Method Summary
collapse
Methods inherited from Base
#cast, #initialize
Instance Method Details
#convert_orig_val ⇒ Object
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/mongomatic/type_converters.rb', line 89
def convert_orig_val
s_val = @orig_val.to_s.downcase
if %w(1 t true y yes).include?(s_val)
true
elsif %w(0 f false n no).include?(s_val)
false
else
nil
end
end
|
#type_match? ⇒ Boolean
85
86
87
|
# File 'lib/mongomatic/type_converters.rb', line 85
def type_match?
@orig_val == true || @orig_val == false
end
|