Class: Avro::SchemaValidator::Result

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResult

Returns a new instance of Result.



28
29
30
# File 'lib/avro/schema_validator.rb', line 28

def initialize
  @errors = []
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



26
27
28
# File 'lib/avro/schema_validator.rb', line 26

def errors
  @errors
end

Instance Method Details

#<<(error) ⇒ Object



32
33
34
# File 'lib/avro/schema_validator.rb', line 32

def <<(error)
  @errors << error
end

#add_error(path, message) ⇒ Object



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

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

#failure?Boolean

Returns:

  • (Boolean)


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

def failure?
  @errors.any?
end

#to_sObject



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

def to_s
  errors.join("\n")
end