Exception: MightyJSON::UnexpectedFieldError
- Inherits:
-
StandardError
- Object
- StandardError
- MightyJSON::UnexpectedFieldError
- Defined in:
- lib/mighty_json/errors.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(path:, value:) ⇒ UnexpectedFieldError
constructor
A new instance of UnexpectedFieldError.
- #to_s ⇒ Object (also: #message)
Constructor Details
#initialize(path:, value:) ⇒ UnexpectedFieldError
Returns a new instance of UnexpectedFieldError.
36 37 38 39 |
# File 'lib/mighty_json/errors.rb', line 36 def initialize(path: , value:) @path = path @value = value end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
34 35 36 |
# File 'lib/mighty_json/errors.rb', line 34 def path @path end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
34 35 36 |
# File 'lib/mighty_json/errors.rb', line 34 def value @value end |
Instance Method Details
#to_s ⇒ Object Also known as: message
41 42 43 44 |
# File 'lib/mighty_json/errors.rb', line 41 def to_s position = "#{path.join('.')}" "Unexpected field of #{position} (#{value})" end |