Module: Sourcify::Method::Parser::RawScanner::Spec::GenericSupport

Defined in:
lib/sourcify/spec/method/raw_scanner/spec_helper.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sourcify/spec/method/raw_scanner/spec_helper.rb', line 15

def self.extended(base)
  base.instance_eval do

    before do
      SCANNER.instance_eval do
        class << self
          alias_method :orig_stop_if_probably_defined_by_proc,
            :stop_if_probably_defined_by_proc
          def stop_if_probably_defined_by_proc; end
        end
      end
    end

    after do
      SCANNER.instance_eval do
        class << self
          alias_method :stop_if_probably_defined_by_proc,
            :orig_stop_if_probably_defined_by_proc
        end
      end
    end

    def process(data)
      SCANNER.process(data)
      SCANNER.tokens
    end

  end
end