Class: Prism::ParseWarning

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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(message, location)
  @message = message
  @location = location
end

Instance Attribute Details

#locationObject (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

#messageObject (readonly)

The message associated with this warning.



335
336
337
# File 'lib/prism/parse_result.rb', line 335

def message
  @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: message, location: location }
end

#inspectObject

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