Class: Rbdantic::ErrorDetail
- Inherits:
-
Object
- Object
- Rbdantic::ErrorDetail
- Defined in:
- lib/rbdantic/error_detail.rb
Overview
Pydantic-compatible error detail structure
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#loc ⇒ Object
readonly
Returns the value of attribute loc.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(type:, loc:, msg:, input: nil) ⇒ ErrorDetail
constructor
A new instance of ErrorDetail.
- #to_h ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(type:, loc:, msg:, input: nil) ⇒ ErrorDetail
8 9 10 11 12 13 |
# File 'lib/rbdantic/error_detail.rb', line 8 def initialize(type:, loc:, msg:, input: nil) @type = type @loc = loc @msg = msg @input = input end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
6 7 8 |
# File 'lib/rbdantic/error_detail.rb', line 6 def input @input end |
#loc ⇒ Object (readonly)
Returns the value of attribute loc.
6 7 8 |
# File 'lib/rbdantic/error_detail.rb', line 6 def loc @loc end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
6 7 8 |
# File 'lib/rbdantic/error_detail.rb', line 6 def msg @msg end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/rbdantic/error_detail.rb', line 6 def type @type end |
Instance Method Details
#as_json ⇒ Object
19 20 21 |
# File 'lib/rbdantic/error_detail.rb', line 19 def as_json(*) to_h end |
#to_h ⇒ Object
15 16 17 |
# File 'lib/rbdantic/error_detail.rb', line 15 def to_h { type: @type, loc: @loc, msg: @msg, input: @input }.compact end |
#to_json(*args) ⇒ Object
23 24 25 |
# File 'lib/rbdantic/error_detail.rb', line 23 def to_json(*args) to_h.to_json(*args) end |