Class: Qonfig::Validation::Collections::InstanceCollection Private

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

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



20
21
22
23
# File 'lib/qonfig/validation/collections/instance_collection.rb', line 20

def initialize
  @validators = []
  @access_lock = Mutex.new
end

Instance Attribute Details

#validatorsArray<Qonfig::Validation::Validators::Base> (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:

  • (Array<Qonfig::Validation::Validators::Base>)

Since:

  • 0.20.0



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

def validators
  @validators
end

Instance Method Details

#add_validator(validator) ⇒ 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:

  • validator (Qonfig::Validation::Validators::Base)

Since:

  • 0.20.0



30
31
32
# File 'lib/qonfig/validation/collections/instance_collection.rb', line 30

def add_validator(validator)
  thread_safe { validators << validator }
end

#concat(collection) ⇒ 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



49
50
51
# File 'lib/qonfig/validation/collections/instance_collection.rb', line 49

def concat(collection)
  thread_safe { validators.concat(collection.validators) }
end

#dupQonfig::Validation::Collections::InstanceCollection

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.



57
58
59
60
61
62
63
# File 'lib/qonfig/validation/collections/instance_collection.rb', line 57

def dup
  thread_safe do
    Qonfig::Validation::Collections::InstanceCollection.new.tap do |duplicate|
      duplicate.concat(self)
    end
  end
end

#each(&block) ⇒ 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 (Proc)

Returns:

  • (Enumerable)

Since:

  • 0.20.0



40
41
42
# File 'lib/qonfig/validation/collections/instance_collection.rb', line 40

def each(&block)
  thread_safe { block_given? ? validators.each(&block) : validators.each }
end