Exception: StrongJSON::Type::UnexpectedFieldError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, value:) ⇒ UnexpectedFieldError

Returns a new instance of UnexpectedFieldError.



225
226
227
228
# File 'lib/strong_json/type.rb', line 225

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



223
224
225
# File 'lib/strong_json/type.rb', line 223

def path
  @path
end

#valueObject (readonly)

Returns the value of attribute value.



223
224
225
# File 'lib/strong_json/type.rb', line 223

def value
  @value
end

Instance Method Details

#to_sObject



230
231
232
233
# File 'lib/strong_json/type.rb', line 230

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