Class: Prism::Translation::Parser::Diagnostic

Inherits:
Parser::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, location) ⇒ Diagnostic

Initialize a new diagnostic with the given message and location.



20
21
22
23
# File 'lib/prism/translation/parser.rb', line 20

def initialize(message, location)
  @message = message
  super(:error, :prism_error, {}, location, [])
end

Instance Attribute Details

#messageObject (readonly)

The message generated by prism.



17
18
19
# File 'lib/prism/translation/parser.rb', line 17

def message
  @message
end