Sha256: 8563c7b3bf5cf1d4197ee16921cc4857d28d2ed6542919567416bf293acce989
Contents?: true
Size: 1.12 KB
Versions: 11
Compression:
Stored size: 1.12 KB
Contents
# frozen_string_literal: true module SmartCore::Validator::Commands # @api private # @since 0.1.0 class ValidateWith < Base # @since 0.1.0 include WorkWithNestedsMixin # @return [Class<SmartCore::Validator>] # # @api private # @since 0.1.0 attr_reader :validating_klass # @return [Proc] # # @api private # @since 0.1.0 attr_reader :nested_validations # @param validating_klass [Class<SmartCore::Validator>] # @param nested_validations [Proc] # @return [void] # # @api private # @since 0.1.0 def initialize(validating_klass, nested_validations) @validating_klass = validating_klass @nested_validations = nested_validations end # @param validator [SmartCore::Validator] # @return [void] # # @api private # @since 0.1.0 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 end end
Version data entries
11 entries across 11 versions & 1 rubygems