Class: ValidationUnexpected

Inherits:
ValidationFailure show all
Defined in:
lib/json_patterns.rb

Constant Summary

Constants included from Inspectable

Inspectable::INSPECTING_KEY

Instance Attribute Summary collapse

Attributes inherited from ValidationFailure

#path

Instance Method Summary collapse

Methods inherited from ValidationFailure

#path_to_s, #to_json

Methods included from HashInitialized

#initialize

Methods included from DeepEquality

#==

Methods included from Inspectable

#inspect

Instance Attribute Details

#expectedObject (readonly)

Returns the value of attribute expected.



228
229
230
# File 'lib/json_patterns.rb', line 228

def expected
  @expected
end

#foundObject (readonly)

Returns the value of attribute found.



228
229
230
# File 'lib/json_patterns.rb', line 228

def found
  @found
end

Instance Method Details

#to_sObject



230
231
232
233
234
235
# File 'lib/json_patterns.rb', line 230

def to_s
  expected = @expected.is_a?(Set) ?
  (@expected.size == 1 ? @expected.to_a[0] : "one of: " + @expected.to_a.join(', ')) :
    @expected
  return "at #{path_to_s}; found #{@found}; expected #{expected}"
end