Class: ActionviewPrecompiler::HelperScanner

Inherits:
Object
  • Object
show all
Defined in:
lib/actionview_precompiler/helper_scanner.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ HelperScanner

Returns a new instance of HelperScanner.



3
4
5
# File 'lib/actionview_precompiler/helper_scanner.rb', line 3

def initialize(dir)
  @dir = dir
end

Instance Method Details

#template_rendersObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/actionview_precompiler/helper_scanner.rb', line 7

def template_renders
  template_renders = []

  each_helper do |fullpath|
    parser = HelperParser.new(fullpath)
    parser.render_calls.each do |render_call|
      virtual_path = render_call.virtual_path

      locals = render_call.locals_keys.map(&:to_s).sort

      template_renders << [virtual_path, locals]
    end
  end

  template_renders.uniq
end