class RuboCop::AST::ProcessedSource
def initialize(source, ruby_version, path = nil, parser_engine: :parser_whitequark)
def initialize(source, ruby_version, path = nil, parser_engine: :parser_whitequark) parser_engine = parser_engine.to_sym unless PARSER_ENGINES.include?(parser_engine) raise ArgumentError, 'The keyword argument `parser_engine` accepts `parser_whitequark` ' \ "or `parser_prism`, but `#{parser_engine}` was passed." end # Defaults source encoding to UTF-8, regardless of the encoding it has # been read with, which could be non-utf8 depending on the default # external encoding. (+source).force_encoding(Encoding::UTF_8) unless source.encoding == Encoding::UTF_8 @raw_source = source @path = path @diagnostics = [] @ruby_version = ruby_version @parser_engine = parser_engine @parser_error = nil parse(source, ruby_version, parser_engine) end