module Prism::Translation::Parser::ProcessedSource

This module gets prepended into RuboCop::AST::ProcessedSource.

Public Instance Methods

parser_class(ruby_version) click to toggle source

Redefine parser_class so that we can inject the prism parser into the list of known parsers.

Calls superclass method
# File prism/translation/parser/rubocop.rb, line 30
def parser_class(ruby_version)
  if ruby_version == Prism::Translation::Parser::VERSION_3_3
    warn "WARN: Setting `TargetRubyVersion: 80_82_73_83_77.33` is deprecated. " \
         "Set to `ParserEngine: parser_prism` and `TargetRubyVersion: 3.3` instead."
    require_relative "../parser33"
    Prism::Translation::Parser33
  elsif ruby_version == Prism::Translation::Parser::VERSION_3_4
    warn "WARN: Setting `TargetRubyVersion: 80_82_73_83_77.34` is deprecated. " \
         "Set to `ParserEngine: parser_prism` and `TargetRubyVersion: 3.4` instead."
    require_relative "../parser34"
    Prism::Translation::Parser34
  else
    super
  end
end