Class: LcpRuby::Metadata::ConfigurationValidator::ValidationResult
- Inherits:
-
Struct
- Object
- Struct
- LcpRuby::Metadata::ConfigurationValidator::ValidationResult
- Defined in:
- lib/lcp_ruby/metadata/configuration_validator.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Instance Method Summary collapse
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors
24 25 26 |
# File 'lib/lcp_ruby/metadata/configuration_validator.rb', line 24 def errors @errors end |
#warnings ⇒ Object
Returns the value of attribute warnings
24 25 26 |
# File 'lib/lcp_ruby/metadata/configuration_validator.rb', line 24 def warnings @warnings end |
Instance Method Details
#to_s ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/lcp_ruby/metadata/configuration_validator.rb', line 29 def to_s lines = [] if errors.any? lines << "Errors (#{errors.size}):" errors.each { |e| lines << " [ERROR] #{e}" } end if warnings.any? lines << "Warnings (#{warnings.size}):" warnings.each { |w| lines << " [WARN] #{w}" } end lines << "Configuration is valid." if valid? && warnings.empty? lines << "Configuration is valid (with warnings)." if valid? && warnings.any? lines.join("\n") end |
#valid? ⇒ Boolean
25 26 27 |
# File 'lib/lcp_ruby/metadata/configuration_validator.rb', line 25 def valid? errors.empty? end |