Class: SmarterJSON::Warning
- Inherits:
-
Struct
- Object
- Struct
- SmarterJSON::Warning
- Defined in:
- lib/smarter_json/warning.rb
Overview
A non-fatal thing the parser worked around while staying lenient — e.g. an empty comma slot it collapsed, a key with no value it read as null, or a duplicate key it dropped. Passed to the on_warning: callable (when process / process_file is given one) once per fix; otherwise the parser stays silent and builds no Warning at all.
type — a Symbol you can branch on (:empty_slot, :empty_value, :duplicate_key)
message — human-readable description
line/col — where it happened in the input
Instance Attribute Summary collapse
-
#col ⇒ Object
Returns the value of attribute col.
-
#line ⇒ Object
Returns the value of attribute line.
-
#message ⇒ Object
Returns the value of attribute message.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#col ⇒ Object
Returns the value of attribute col
12 13 14 |
# File 'lib/smarter_json/warning.rb', line 12 def col @col end |
#line ⇒ Object
Returns the value of attribute line
12 13 14 |
# File 'lib/smarter_json/warning.rb', line 12 def line @line end |
#message ⇒ Object
Returns the value of attribute message
12 13 14 |
# File 'lib/smarter_json/warning.rb', line 12 def @message end |
#type ⇒ Object
Returns the value of attribute type
12 13 14 |
# File 'lib/smarter_json/warning.rb', line 12 def type @type end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/smarter_json/warning.rb', line 13 def to_s line ? "#{} at line #{line}, col #{col}" : end |