Class: Odin::Errors::ValidationResult
- Inherits:
-
Object
- Object
- Odin::Errors::ValidationResult
- Defined in:
- lib/odin/types/errors.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(errors = []) ⇒ ValidationResult
constructor
A new instance of ValidationResult.
- #valid? ⇒ Boolean
Constructor Details
#initialize(errors = []) ⇒ ValidationResult
Returns a new instance of ValidationResult.
123 124 125 |
# File 'lib/odin/types/errors.rb', line 123 def initialize(errors = []) @errors = errors.freeze end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
121 122 123 |
# File 'lib/odin/types/errors.rb', line 121 def errors @errors end |
Class Method Details
.valid ⇒ Object
131 132 133 |
# File 'lib/odin/types/errors.rb', line 131 def self.valid new([]) end |
.with_errors(errors) ⇒ Object
135 136 137 |
# File 'lib/odin/types/errors.rb', line 135 def self.with_errors(errors) new(errors) end |
Instance Method Details
#valid? ⇒ Boolean
127 128 129 |
# File 'lib/odin/types/errors.rb', line 127 def valid? errors.empty? end |