Class: SmartCore::Validator::ErrorSet Private

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_core/validator/error_set.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.1.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.1.0



11
12
13
14
# File 'lib/smart_core/validator/error_set.rb', line 11

def initialize
  @errors = Set.new
  @access_lock = Mutex.new
end

Instance Method Details

#add_error(error_code) ⇒ 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:

  • error_codes (Arrray<Symbol>)

Since:

  • 0.1.0



21
22
23
# File 'lib/smart_core/validator/error_set.rb', line 21

def add_error(error_code)
  thread_safe { store_error(error_code) }
end

#clearvoid

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.

Since:

  • 0.1.0



50
51
52
# File 'lib/smart_core/validator/error_set.rb', line 50

def clear
  thread_safe { errors.clear }
end

#codesArray<Symbol>

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<Symbol>)

Since:

  • 0.1.0



58
59
60
# File 'lib/smart_core/validator/error_set.rb', line 58

def codes
  thread_safe { errors.to_a }
end

#concat(error_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:

Since:

  • 0.1.0



30
31
32
33
34
35
36
# File 'lib/smart_core/validator/error_set.rb', line 30

def concat(error_set)
  thread_safe do
    error_set.codes.each do |error_code|
      store_error(error_code)
    end
  end
end

#empty?Boolean

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:

  • (Boolean)

Since:

  • 0.1.0



42
43
44
# File 'lib/smart_core/validator/error_set.rb', line 42

def empty?
  thread_safe { errors.empty? }
end