Exception: StrongJSON::Type::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, type:, value:) ⇒ Error

Returns a new instance of Error.



117
118
119
120
121
# File 'lib/strong_json/type.rb', line 117

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



115
116
117
# File 'lib/strong_json/type.rb', line 115

def path
  @path
end

#typeObject (readonly)

Returns the value of attribute type.



115
116
117
# File 'lib/strong_json/type.rb', line 115

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



115
116
117
# File 'lib/strong_json/type.rb', line 115

def value
  @value
end

Instance Method Details

#to_sObject



123
124
125
# File 'lib/strong_json/type.rb', line 123

def to_s
  "Expected type of value at #{path.join('.')} (#{value}) is #{type}"
end