Sha256: 53a7ef5ef9c760216cb2fcc4149eb7e9e409a68bc420fdc10607e406d83bdb5a

Contents?: true

Size: 744 Bytes

Versions: 11

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

module SmartCore::Validator::Commands
  # @api private
  # @since 0.1.0
  class AddValidation < Base
    # @return [Symbol, String]
    #
    # @api private
    # @since 0.1.0
    attr_reader :validating_method

    # @param validating_method [String, Symbol]
    # @return [void]
    #
    # @api private
    # @since 0.1.0
    def initialize(validating_method)
      @validating_method = validating_method
    end

    # @param validator [SmartCore::Validator]
    # @return [void]
    #
    # @api private
    # @since 0.1.0
    def call(validator)
      errors = SmartCore::Validator::Invoker.call(validator, validating_method)
      validator.__append_errors__(errors) unless errors.empty?
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
smart_core-0.8.1 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.8.0 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.7.0 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.6.0 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.5.2 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.5.1 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.5.0 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.4.0 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.3.0 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.2.0 lib/smart_core/validator/commands/add_validation.rb
smart_core-0.1.0 lib/smart_core/validator/commands/add_validation.rb