Class: Prism::Translation::Parser::PrismDiagnostic

Inherits:
Diagnostic
  • Object
show all
Defined in:
lib/prism/translation/parser.rb

Overview

The parser gem has a list of diagnostics with a hard-coded set of error messages. We create our own diagnostic class in order to set our own error messages.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, level, reason, location) ⇒ PrismDiagnostic

Initialize a new diagnostic with the given message and location.



28
29
30
31
# File 'lib/prism/translation/parser.rb', line 28

def initialize(message, level, reason, location)
  @message = message
  super(level, reason, {}, location, [])
end

Instance Attribute Details

#messageObject (readonly)

This is the cached message coming from prism.



25
26
27
# File 'lib/prism/translation/parser.rb', line 25

def message
  @message
end