Class: ActiveRemote::Typecasting::BooleanTypecaster
- Inherits:
-
Object
- Object
- ActiveRemote::Typecasting::BooleanTypecaster
- Defined in:
- lib/active_remote/typecasting/boolean_typecaster.rb
Constant Summary collapse
- FALSE_VALUES =
["n", "N", "no", "No", "NO", "false", "False", "FALSE", "off", "Off", "OFF", "f", "F"]
Class Method Summary collapse
Class Method Details
.call(value) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/active_remote/typecasting/boolean_typecaster.rb', line 6 def self.call(value) case value when *FALSE_VALUES then false when Numeric, /^\-?[0-9]/ then !value.to_f.zero? else value.present? end end |