Class: Qonfig::Validator::Predefined::Common Private

Inherits:
Basic
  • Object
show all
Defined in:
lib/qonfig/validator/predefined/common.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.

Since:

  • 0.13.0

Instance Attribute Summary collapse

Attributes inherited from Basic

#setting_key_matcher

Instance Method Summary collapse

Methods inherited from Basic

#validate

Constructor Details

#initialize(setting_key_matcher, validation) ⇒ 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.

Parameters:

Since:

  • 0.13.0



18
19
20
21
# File 'lib/qonfig/validator/predefined/common.rb', line 18

def initialize(setting_key_matcher, validation)
  super(setting_key_matcher)
  @validation = validation
end

Instance Attribute Details

#validationProc (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.

Returns:

  • (Proc)

Since:

  • 0.13.0



10
11
12
# File 'lib/qonfig/validator/predefined/common.rb', line 10

def validation
  @validation
end

Instance Method Details

#validate_concrete(data_set) ⇒ 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.

Parameters:

Raises:

Since:

  • 0.13.0



30
31
32
33
34
35
36
37
38
39
# File 'lib/qonfig/validator/predefined/common.rb', line 30

def validate_concrete(data_set)
  data_set.settings.__deep_each_setting__ do |setting_key, setting_value|
    next unless setting_key_matcher.match?(setting_key)

    raise(
      Qonfig::ValidationError,
      "Invalid value of setting <#{setting_key}> (#{setting_value})"
    ) unless validation.call(setting_value)
  end
end

#validate_full(data_set) ⇒ 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.

Parameters:

Raises:

Since:

  • 0.13.0



48
49
50
51
52
# File 'lib/qonfig/validator/predefined/common.rb', line 48

def validate_full(data_set)
  # :nocov:
  raise Qonfig::Error, 'Predefined validator should be used only with a setting key'
  # :nocov:
end