Class: Prism::ParseWarning
- Inherits:
-
Object
- Object
- Prism::ParseWarning
- Defined in:
- lib/prism/parse_result.rb,
ext/prism/extension.c
Overview
This represents a warning that was encountered during parsing.
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
A Location object representing the location of this warning in the source.
-
#message ⇒ Object
readonly
The message associated with this warning.
Instance Method Summary collapse
-
#deconstruct_keys(keys) ⇒ Object
Implement the hash pattern matching interface for ParseWarning.
-
#initialize(message, location) ⇒ ParseWarning
constructor
Create a new warning object with the given message and location.
-
#inspect ⇒ Object
Returns a string representation of this warning.
Constructor Details
#initialize(message, location) ⇒ ParseWarning
Create a new warning object with the given message and location.
341 342 343 344 |
# File 'lib/prism/parse_result.rb', line 341 def initialize(, location) @message = @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
A Location object representing the location of this warning in the source.
338 339 340 |
# File 'lib/prism/parse_result.rb', line 338 def location @location end |
#message ⇒ Object (readonly)
The message associated with this warning.
335 336 337 |
# File 'lib/prism/parse_result.rb', line 335 def @message end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
Implement the hash pattern matching interface for ParseWarning.
347 348 349 |
# File 'lib/prism/parse_result.rb', line 347 def deconstruct_keys(keys) { message: , location: location } end |
#inspect ⇒ Object
Returns a string representation of this warning.
352 353 354 |
# File 'lib/prism/parse_result.rb', line 352 def inspect "#<Prism::ParseWarning @message=#{@message.inspect} @location=#{@location.inspect}>" end |