Class: Qonfig::Validation::Collections::PredefinedRegistry Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/qonfig/validation/collections/predefined_registry.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.20.0

Instance Method Summary collapse

Constructor Details

#initializevoid

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.

Since:

  • 0.20.0



13
14
15
16
# File 'lib/qonfig/validation/collections/predefined_registry.rb', line 13

def initialize
  @validators = {}
  @lock = Mutex.new
end

Instance Method Details

#dupQonfig::Validation::Collection::PredefinedRegistry

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:

  • (Qonfig::Validation::Collection::PredefinedRegistry)

Since:

  • 0.20.0



52
53
54
# File 'lib/qonfig/validation/collections/predefined_registry.rb', line 52

def dup
  thread_safe { duplicate }
end

#each(&block) {|validator_name, validation_logic| ... } ⇒ Enumerable

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:

  • block (Block)

Yields:

  • (validator_name, validation_logic)

Yield Parameters:

  • validator_name (String)
  • validation_logic (Proc)

Returns:

  • (Enumerable)

Since:

  • 0.20.0



64
65
66
67
68
# File 'lib/qonfig/validation/collections/predefined_registry.rb', line 64

def each(&block)
  thread_safe do
    block_given? ? validators.each_pair(&block) : validators.each_pair
  end
end

#merge(predefined_registry) ⇒ 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.20.0



23
24
25
# File 'lib/qonfig/validation/collections/predefined_registry.rb', line 23

def merge(predefined_registry)
  thread_safe { concat(predefined_registry) }
end

#register(name, validation) ⇒ void Also known as: []=

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:

  • name (String, Symbol)
  • validation (Proc)

Since:

  • 0.20.0



33
34
35
# File 'lib/qonfig/validation/collections/predefined_registry.rb', line 33

def register(name, validation)
  thread_safe { apply(name, validation) }
end

#resolve(name) ⇒ Proc Also known as: []

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:

  • name (String, Symbol)

Returns:

  • (Proc)

Since:

  • 0.20.0



43
44
45
# File 'lib/qonfig/validation/collections/predefined_registry.rb', line 43

def resolve(name)
  thread_safe { fetch(name) }
end