Exception: StrongJSON::Type::TypeError

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:) ⇒ TypeError

Returns a new instance of TypeError.



395
396
397
398
399
400
401
# File 'lib/strong_json/type.rb', line 395

def initialize(path:, value:)
  @path = path
  @value = value
  type = path.type
  s = type.alias || type
  super "TypeError at #{path.to_s}: expected=#{s}, value=#{value.inspect}"
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



393
394
395
# File 'lib/strong_json/type.rb', line 393

def path
  @path
end

#valueObject (readonly)

Returns the value of attribute value.



393
394
395
# File 'lib/strong_json/type.rb', line 393

def value
  @value
end

Instance Method Details

#typeObject



403
404
405
# File 'lib/strong_json/type.rb', line 403

def type
  path.type
end