Class: WhatDyaReturn::AST::ProcessedSource

Inherits:
RuboCop::AST::ProcessedSource
  • Object
show all
Defined in:
lib/what_dya_return/ast/processed_source.rb

Overview

Override ‘RuboCop::AST::ProcessedSource#create_parser` to use `WhatDyaReturn::AST::Builder` instead of `RuboCop::AST::Builder`

Instance Method Summary collapse

Instance Method Details

#create_parser(ruby_version) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/what_dya_return/ast/processed_source.rb', line 10

def create_parser(ruby_version)
  builder = Builder.new

  parser_class(ruby_version).new(builder).tap do |parser|
    parser.diagnostics.all_errors_are_fatal = (RUBY_ENGINE != 'ruby')
    parser.diagnostics.ignore_warnings = false
    parser.diagnostics.consumer = lambda do |diagnostic|
      @diagnostics << diagnostic
    end
  end
end