Class: Kharon::Processors::BooleanProcessor
- Inherits:
-
Kharon::Processor
- Object
- Kharon::Processor
- Kharon::Processors::BooleanProcessor
- Defined in:
- lib/kharon/processors/boolean_processor.rb
Overview
Processor to validate booleans. It only has the default options.
Instance Attribute Summary
Attributes inherited from Kharon::Processor
Instance Method Summary (collapse)
-
- (Object) process(key, options = {})
Checks if the given key is a boolean or not.
Methods inherited from Kharon::Processor
Constructor Details
This class inherits a constructor from Kharon::Processor
Instance Method Details
- (Object) process(key, options = {})
Checks if the given key is a boolean or not.
15 16 17 18 |
# File 'lib/kharon/processors/boolean_processor.rb', line 15 def process(key, = {}) before_all(key, ) match?(key, /(true)|(false)/) ? store(key, ->(item){to_boolean(item)}, ) : raise_type_error(key, "Numeric") end |