Class: SmartCore::Validator::Commands::ValidateWith Private
- Includes:
- WorkWithNestedsMixin
- Defined in:
- lib/smart_core/validator/commands/validate_with.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #nested_validations ⇒ Proc readonly private
- #validating_klass ⇒ Class<SmartCore::Validator> readonly private
Instance Method Summary collapse
- #call(validator) ⇒ void private
- #initialize(validating_klass, nested_validations) ⇒ void constructor private
Methods included from WorkWithNestedsMixin
#build_nested_validator, #build_sub_validator, #check_nested_validations
Constructor Details
#initialize(validating_klass, nested_validations) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 |
# File 'lib/smart_core/validator/commands/validate_with.rb', line 28 def initialize(validating_klass, nested_validations) @validating_klass = validating_klass @nested_validations = nested_validations end |
Instance Attribute Details
#nested_validations ⇒ Proc (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/smart_core/validator/commands/validate_with.rb', line 20 def nested_validations @nested_validations end |
#validating_klass ⇒ Class<SmartCore::Validator> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/smart_core/validator/commands/validate_with.rb', line 14 def validating_klass @validating_klass end |
Instance Method Details
#call(validator) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
38 39 40 41 42 43 44 45 46 |
# File 'lib/smart_core/validator/commands/validate_with.rb', line 38 def call(validator) sub_validator = build_sub_validator(validator, validating_klass) if sub_validator.valid? check_nested_validations(validator, nested_validations) else validator.__append_errors__(sub_validator.__validation_errors__) end end |