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
-
#level ⇒ Object
readonly
The level of this warning.
-
#location ⇒ Object
readonly
A Location object representing the location of this warning in the source.
-
#message ⇒ Object
readonly
The message associated with this warning.
-
#type ⇒ Object
readonly
The type of warning.
Instance Method Summary collapse
-
#deconstruct_keys(keys) ⇒ Object
Implement the hash pattern matching interface for ParseWarning.
-
#initialize(type, message, location, level) ⇒ 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(type, message, location, level) ⇒ ParseWarning
Create a new warning object with the given message and location.
641 642 643 644 645 646 |
# File 'lib/prism/parse_result.rb', line 641 def initialize(type, , location, level) @type = type @message = @location = location @level = level end |
Instance Attribute Details
#level ⇒ Object (readonly)
The level of this warning.
638 639 640 |
# File 'lib/prism/parse_result.rb', line 638 def level @level end |
#location ⇒ Object (readonly)
A Location object representing the location of this warning in the source.
635 636 637 |
# File 'lib/prism/parse_result.rb', line 635 def location @location end |
#message ⇒ Object (readonly)
The message associated with this warning.
632 633 634 |
# File 'lib/prism/parse_result.rb', line 632 def @message end |
#type ⇒ Object (readonly)
The type of warning. This is an internal symbol that is used for communicating with translation layers. It is not meant to be public API.
629 630 631 |
# File 'lib/prism/parse_result.rb', line 629 def type @type end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
Implement the hash pattern matching interface for ParseWarning.
649 650 651 |
# File 'lib/prism/parse_result.rb', line 649 def deconstruct_keys(keys) { type: type, message: , location: location, level: level } end |
#inspect ⇒ Object
Returns a string representation of this warning.
654 655 656 |
# File 'lib/prism/parse_result.rb', line 654 def inspect "#<Prism::ParseWarning @type=#{@type.inspect} @message=#{@message.inspect} @location=#{@location.inspect} @level=#{@level.inspect}>" end |