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.



146
147
148
149
# File 'lib/strong_json/type.rb', line 146

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



144
145
146
# File 'lib/strong_json/type.rb', line 144

def path
  @path
end

#valueObject (readonly)

Returns the value of attribute value.



144
145
146
# File 'lib/strong_json/type.rb', line 144

def value
  @value
end

Instance Method Details

#to_sObject



151
152
153
154
# File 'lib/strong_json/type.rb', line 151

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