Exception: MightyJSON::Error
- Inherits:
-
StandardError
- Object
- StandardError
- MightyJSON::Error
- Defined in:
- lib/mighty_json/errors.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(path:, type:, value:) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object (also: #message)
Constructor Details
#initialize(path:, type:, value:) ⇒ Error
Returns a new instance of Error.
7 8 9 10 11 |
# File 'lib/mighty_json/errors.rb', line 7 def initialize(path:, type:, value:) @path = path @type = type @value = value end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/mighty_json/errors.rb', line 5 def path @path end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/mighty_json/errors.rb', line 5 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/mighty_json/errors.rb', line 5 def value @value end |
Instance Method Details
#to_s ⇒ Object Also known as: message
13 14 15 16 |
# File 'lib/mighty_json/errors.rb', line 13 def to_s position = path.empty? ? "" : " at .#{path.join('.')}" "Expected type of value #{value}#{position} is #{type}" end |