Class: Prism::ParseError
Overview
This represents an error that was encountered during parsing.
Instance Attribute Summary collapse
-
#level ⇒ Object
readonly
The level of this error.
-
#location ⇒ Object
readonly
A Location object representing the location of this error in the source.
-
#message ⇒ Object
readonly
The message associated with this error.
Instance Method Summary collapse
-
#deconstruct_keys(keys) ⇒ Object
Implement the hash pattern matching interface for ParseError.
-
#initialize(message, location, level) ⇒ ParseError
constructor
Create a new error object with the given message and location.
-
#inspect ⇒ Object
Returns a string representation of this error.
Constructor Details
#initialize(message, location, level) ⇒ ParseError
Create a new error object with the given message and location.
319 320 321 322 323 |
# File 'lib/prism/parse_result.rb', line 319 def initialize(, location, level) @message = @location = location @level = level end |
Instance Attribute Details
#level ⇒ Object (readonly)
The level of this error.
316 317 318 |
# File 'lib/prism/parse_result.rb', line 316 def level @level end |
#location ⇒ Object (readonly)
A Location object representing the location of this error in the source.
313 314 315 |
# File 'lib/prism/parse_result.rb', line 313 def location @location end |
#message ⇒ Object (readonly)
The message associated with this error.
310 311 312 |
# File 'lib/prism/parse_result.rb', line 310 def @message end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
Implement the hash pattern matching interface for ParseError.
326 327 328 |
# File 'lib/prism/parse_result.rb', line 326 def deconstruct_keys(keys) { message: , location: location, level: level } end |
#inspect ⇒ Object
Returns a string representation of this error.
331 332 333 |
# File 'lib/prism/parse_result.rb', line 331 def inspect "#<Prism::ParseError @message=#{@message.inspect} @location=#{@location.inspect} @level=#{@level.inspect}>" end |