Class: Avro::SchemaValidator::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/avro/schema_validator.rb

Instance Method Summary collapse

Instance Method Details

#<<(error) ⇒ Object



36
37
38
# File 'lib/avro/schema_validator.rb', line 36

def <<(error)
  errors << error
end

#add_error(path, message) ⇒ Object



40
41
42
# File 'lib/avro/schema_validator.rb', line 40

def add_error(path, message)
  self << "at #{path} #{message}"
end

#errorsObject



52
53
54
55
# File 'lib/avro/schema_validator.rb', line 52

def errors
  # Use less memory for success results by lazily creating the errors array
  @errors ||= []
end

#failure?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/avro/schema_validator.rb', line 44

def failure?
  defined?(@errors) && errors.any?
end

#to_sObject



48
49
50
# File 'lib/avro/schema_validator.rb', line 48

def to_s
  failure? ? errors.join("\n") : ''
end