Class: Codependent::Validators::ConstructorInjectionValidator
- Inherits:
-
Object
- Object
- Codependent::Validators::ConstructorInjectionValidator
- Defined in:
- lib/codependent/validators/constructor_injection_validator.rb
Constant Summary collapse
- MISSING_TYPE_ERROR =
'Constructor injection requires a type to be specified.'.freeze
- MISSING_DEPENDENCY_KEYWORDS_ERROR =
'All dependencies must appear as keyword arguments to the constructor.'.freeze
- NO_ARGS_WITH_DEPENDENCIES_ERROR =
'Constructor injection requires the constructor to receive arguments.'.freeze
Instance Method Summary collapse
Instance Method Details
#call(_, state, dependencies) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/codependent/validators/constructor_injection_validator.rb', line 8 def call(_, state, dependencies) raise MISSING_TYPE_ERROR unless state[:type] return unless dependencies.count > 0 validate_constructor_params(state[:type], dependencies) end |