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.
131 132 133 |
# File 'lib/odin/types/errors.rb', line 131 def initialize(errors = []) @errors = errors.freeze end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
129 130 131 |
# File 'lib/odin/types/errors.rb', line 129 def errors @errors end |
Class Method Details
.valid ⇒ Object
139 140 141 |
# File 'lib/odin/types/errors.rb', line 139 def self.valid new([]) end |
.with_errors(errors) ⇒ Object
143 144 145 |
# File 'lib/odin/types/errors.rb', line 143 def self.with_errors(errors) new(errors) end |
Instance Method Details
#valid? ⇒ Boolean
135 136 137 |
# File 'lib/odin/types/errors.rb', line 135 def valid? errors.empty? end |