Exception: MightyJSON::Type::UnexpectedFieldError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/mighty_json/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, value:) ⇒ UnexpectedFieldError

Returns a new instance of UnexpectedFieldError.



203
204
205
206
# File 'lib/mighty_json/type.rb', line 203

def initialize(path: , value:)
  @path = path
  @value = value
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



201
202
203
# File 'lib/mighty_json/type.rb', line 201

def path
  @path
end

#valueObject (readonly)

Returns the value of attribute value.



201
202
203
# File 'lib/mighty_json/type.rb', line 201

def value
  @value
end

Instance Method Details

#to_sObject



208
209
210
211
# File 'lib/mighty_json/type.rb', line 208

def to_s
  position = "#{path.join('.')}"
  "Unexpected field of #{position} (#{value})"
end