Class: Serega::SeregaValidations::Utils::CheckExtraKeywordArg
- Inherits:
-
Object
- Object
- Serega::SeregaValidations::Utils::CheckExtraKeywordArg
- Defined in:
- lib/serega/validations/utils/check_extra_keyword_arg.rb
Overview
Utility to check that callable object has no required keyword arguments
Class Method Summary collapse
-
.call(callable, callable_description) ⇒ void
Checks hash keys are allowed.
Class Method Details
.call(callable, callable_description) ⇒ void
This method returns an undefined value.
Checks hash keys are allowed
21 22 23 24 25 26 27 28 29 |
# File 'lib/serega/validations/utils/check_extra_keyword_arg.rb', line 21 def self.call(callable, callable_description) parameters = callable.is_a?(Proc) ? callable.parameters : callable.method(:call).parameters parameters.each do |parameter| next unless parameter[0] == :keyreq raise Serega::SeregaError, "Invalid #{callable_description}. It should not have any required keyword arguments" end end |