Class: Avro::SchemaValidator::Result

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResult

Returns a new instance of Result.



29
30
31
# File 'lib/avro-patches/schema_validator/schema_validator.rb', line 29

def initialize
  @errors = []
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



27
28
29
# File 'lib/avro-patches/schema_validator/schema_validator.rb', line 27

def errors
  @errors
end

Instance Method Details

#<<(error) ⇒ Object



33
34
35
# File 'lib/avro-patches/schema_validator/schema_validator.rb', line 33

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

#add_error(path, message) ⇒ Object



37
38
39
# File 'lib/avro-patches/schema_validator/schema_validator.rb', line 37

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

#failure?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/avro-patches/schema_validator/schema_validator.rb', line 41

def failure?
  @errors.any?
end

#to_sObject



45
46
47
# File 'lib/avro-patches/schema_validator/schema_validator.rb', line 45

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