Class: SmartCore::Validator::Invoker Private

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

Constant Summary collapse

Error =

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

Since:

  • 0.4.0

Class.new(StandardError)
StopValidationError =

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

Since:

  • 0.4.0

Class.new(Error)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(validator) ⇒ 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.

Since:

  • 0.1.0



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

def initialize(validator)
  @validator = validator
  @access_lock = Mutex.new
end

Instance Attribute Details

#validatorSmartCore::Validator (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.

Since:

  • 0.1.0k



35
36
37
# File 'lib/smart_core/validator/invoker.rb', line 35

def validator
  @validator
end

Class Method Details

.call(validator, validating_method) ⇒ SmartCore::Validator::ErrorSet

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



26
27
28
# File 'lib/smart_core/validator/invoker.rb', line 26

def call(validator, validating_method)
  new(validator).call(validating_method)
end

Instance Method Details

#call(validating_method) ⇒ SmartCore::Validator::ErrorSet

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



53
54
55
56
57
58
59
60
61
62
# File 'lib/smart_core/validator/invoker.rb', line 53

def call(validating_method)
  thread_safe do
    ErrorSet.new.tap do |outer_errors|
      begin
        extended_validator(outer_errors).send(validating_method)
      rescue StopValidationError
      end
    end
  end
end