Class: Serega::SeregaValidations::Utils::CheckAllowedKeys
- Inherits:
-
Object
- Object
- Serega::SeregaValidations::Utils::CheckAllowedKeys
- Defined in:
- lib/serega/validations/utils/check_allowed_keys.rb
Overview
Utility to check all hash keys are allowed
Class Method Summary collapse
-
.call(opts, allowed_keys) ⇒ void
Checks hash keys are allowed.
Class Method Details
.call(opts, allowed_keys) ⇒ void
This method returns an undefined value.
Checks hash keys are allowed
21 22 23 24 25 26 27 |
# File 'lib/serega/validations/utils/check_allowed_keys.rb', line 21 def self.call(opts, allowed_keys) opts.each_key do |key| next if allowed_keys.include?(key) raise SeregaError, "Invalid option #{key.inspect}. Allowed options are: #{allowed_keys.map(&:inspect).join(", ")}" end end |