Module: Sourcify::Method::Parser::RawScanner::Spec::KwBlockStartSupport

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

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/sourcify/spec/method/raw_scanner/spec_helper.rb', line 47

def self.extended(base)
  base.instance_eval do

    before do
      Extensions::Counter.class_eval do
        alias_method :orig_started?, :started?
        def started?; true; end
      end
    end

    after do
      Extensions::Counter.class_eval do
        alias_method :started?, :orig_started?
      end
    end

    def kw_block_start_counter(data)
      SCANNER.process(data)
      SCANNER.counter.counts
    end

    def kw_block_start_alias1
      %w{class do module begin case module if unless}
    end

    def kw_block_start_alias2
      %w{while until for}
    end
  end
end