Class: ForemanDeployments::Validation::ValidationResult
- Inherits:
-
Object
- Object
- ForemanDeployments::Validation::ValidationResult
- Defined in:
- app/lib/foreman_deployments/validation/validation_result.rb
Instance Attribute Summary collapse
-
#messages ⇒ Object
Returns the value of attribute messages.
Instance Method Summary collapse
-
#initialize(messages = {}) ⇒ ValidationResult
constructor
A new instance of ValidationResult.
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(messages = {}) ⇒ ValidationResult
Returns a new instance of ValidationResult.
6 7 8 9 |
# File 'app/lib/foreman_deployments/validation/validation_result.rb', line 6 def initialize( = {}) fail('messages need to be either hash or array') if !.is_a?(Array) && !.is_a?(Hash) = end |
Instance Attribute Details
#messages ⇒ Object
Returns the value of attribute messages.
4 5 6 |
# File 'app/lib/foreman_deployments/validation/validation_result.rb', line 4 def end |
Instance Method Details
#to_s ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/lib/foreman_deployments/validation/validation_result.rb', line 15 def to_s if .is_a?(Array) .join("\n") else .collect do |key, | "#{key}: #{message}" end.join("\n") end end |
#valid? ⇒ Boolean
11 12 13 |
# File 'app/lib/foreman_deployments/validation/validation_result.rb', line 11 def valid? .empty? end |