Class: Odin::Errors::ValidationResult

Inherits:
Object
  • Object
show all
Defined in:
lib/odin/types/errors.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#errorsObject (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

.validObject



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

Returns:

  • (Boolean)


135
136
137
# File 'lib/odin/types/errors.rb', line 135

def valid?
  errors.empty?
end