Class: Serega::SeregaValidations::Utils::CheckOptIsBool
- Inherits:
-
Object
- Object
- Serega::SeregaValidations::Utils::CheckOptIsBool
- Defined in:
- lib/serega/validations/utils/check_opt_is_bool.rb
Overview
Utility to check hash key value is boolean
Class Method Summary collapse
-
.call(opts, key) ⇒ void
Checks hash key has boolean value.
Class Method Details
.call(opts, key) ⇒ void
This method returns an undefined value.
Checks hash key has boolean value
18 19 20 21 22 23 24 25 |
# File 'lib/serega/validations/utils/check_opt_is_bool.rb', line 18 def self.call(opts, key) return unless opts.key?(key) value = opts[key] return if value.equal?(true) || value.equal?(false) raise SeregaError, "Invalid option #{key.inspect} => #{value.inspect}. Must have a boolean value" end |