Class: Prism::ParseError
- Inherits:
-
Object
- Object
- Prism::ParseError
- Defined in:
- lib/prism/parse_result.rb,
ext/prism/extension.c
Overview
This represents an error that was encountered during parsing.
Instance Attribute Summary collapse
-
#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) ⇒ 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) ⇒ ParseError
Create a new error object with the given message and location.
316 317 318 319 |
# File 'lib/prism/parse_result.rb', line 316 def initialize(, location) @message = @location = location end |
Instance Attribute Details
#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.
322 323 324 |
# File 'lib/prism/parse_result.rb', line 322 def deconstruct_keys(keys) { message: , location: location } end |
#inspect ⇒ Object
Returns a string representation of this error.
327 328 329 |
# File 'lib/prism/parse_result.rb', line 327 def inspect "#<Prism::ParseError @message=#{@message.inspect} @location=#{@location.inspect}>" end |