Class: Longleaf::ConfigurationValidationResult
- Inherits:
-
Object
- Object
- Longleaf::ConfigurationValidationResult
- Defined in:
- lib/longleaf/services/configuration_validator.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize ⇒ ConfigurationValidationResult
constructor
A new instance of ConfigurationValidationResult.
- #raise_if_invalid ⇒ Object
-
#register_error(error_message) ⇒ Object
Register an error with this validation result.
-
#valid? ⇒ boolean
True if validation produced not errors.
Constructor Details
#initialize ⇒ ConfigurationValidationResult
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
#errors ⇒ Object (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_invalid ⇒ Object
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() @errors << end |
#valid? ⇒ boolean
Returns true if validation produced not errors.
62 63 64 |
# File 'lib/longleaf/services/configuration_validator.rb', line 62 def valid? @errors.length == 0 end |