Class: Longleaf::ConfigurationValidationResult

Inherits:
Object
  • Object
show all
Defined in:
lib/longleaf/services/configuration_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfigurationValidationResult

Returns a new instance of ConfigurationValidationResult.



52
53
54
# File 'lib/longleaf/services/configuration_validator.rb', line 52

def initialize
  @errors = Array.new
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



50
51
52
# File 'lib/longleaf/services/configuration_validator.rb', line 50

def errors
  @errors
end

Instance Method Details

#raise_if_invalidObject

Raises:



67
68
69
# File 'lib/longleaf/services/configuration_validator.rb', line 67

def raise_if_invalid
  raise ConfigurationError.new(@errors.join("\n")) unless valid?
end

#register_error(error_message) ⇒ Object

Register an error with this validation result



57
58
59
# File 'lib/longleaf/services/configuration_validator.rb', line 57

def register_error(error_message)
  @errors << error_message
end

#valid?boolean

Returns true if validation produced not errors.

Returns:

  • (boolean)

    true if validation produced not errors



62
63
64
# File 'lib/longleaf/services/configuration_validator.rb', line 62

def valid?
  @errors.length == 0
end