Module: Qonfig::Validator::DSL Private

Included in:
DataSet
Defined in:
lib/qonfig/validator/dsl.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.13.0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(child_klass) ⇒ 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:

Since:

  • 0.13.0



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/qonfig/validator/dsl.rb', line 12

def extended(child_klass)
  child_klass.instance_variable_set(:@validators, Qonfig::Validator::Collection.new)

  child_klass.singleton_class.prepend(Module.new do
    def inherited(child_klass)
      child_klass.instance_variable_set(:@validators, Qonfig::Validator::Collection.new)
      child_klass.validators.concat(validators)
      super
    end
  end)
end

Instance Method Details

#validate(setting_key_pattern = nil, predefined = nil, by: nil, &custom_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.

This method returns an undefined value.

Parameters:

  • setting_key_pattern (String, Symbol, NilClass) (defaults to: nil)
  • predefined (String, Symbol) (defaults to: nil)
  • custom_validation (Proc)
  • by (Hash) (defaults to: nil)

    a customizable set of options

Options Hash (by:):

  • (String, Symbol, NilClass)

See Also:

Since:

  • 0.13.0



43
44
45
46
47
48
49
50
# File 'lib/qonfig/validator/dsl.rb', line 43

def validate(setting_key_pattern = nil, predefined = nil, by: nil, &custom_validation)
  validators << Qonfig::Validator::Builder.build(
    setting_key_pattern: setting_key_pattern,
    predefined_validator: predefined,
    runtime_validation_method: by,
    validation_logic: custom_validation
  )
end

#validatorsQonfig::Validator::Collection

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:

Since:

  • 0.13.0



29
30
31
# File 'lib/qonfig/validator/dsl.rb', line 29

def validators
  @validators
end