Class: ActionviewPrecompiler::TemplateScanner
- Inherits:
-
Object
- Object
- ActionviewPrecompiler::TemplateScanner
- Defined in:
- lib/actionview_precompiler/template_scanner.rb
Instance Attribute Summary collapse
-
#view_dir ⇒ Object
readonly
Returns the value of attribute view_dir.
Instance Method Summary collapse
-
#initialize(view_dir) ⇒ TemplateScanner
constructor
A new instance of TemplateScanner.
- #template_renders ⇒ Object
Constructor Details
#initialize(view_dir) ⇒ TemplateScanner
Returns a new instance of TemplateScanner.
7 8 9 |
# File 'lib/actionview_precompiler/template_scanner.rb', line 7 def initialize(view_dir) @view_dir = view_dir end |
Instance Attribute Details
#view_dir ⇒ Object (readonly)
Returns the value of attribute view_dir.
5 6 7 |
# File 'lib/actionview_precompiler/template_scanner.rb', line 5 def view_dir @view_dir end |
Instance Method Details
#template_renders ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/actionview_precompiler/template_scanner.rb', line 11 def template_renders template_renders = [] each_template do |template| parser = TemplateParser.new(template.fullpath) parser.render_calls.each do |render_call| virtual_path = render_call.virtual_path unless virtual_path.include?("/") # Not necessarily true, since the perfix is based on the current # controller, but is a safe bet most of the time. virtual_path = "#{template.prefix}/#{virtual_path}" end locals = render_call.locals_keys.map(&:to_s).sort template_renders << [virtual_path, locals] end end template_renders.uniq end |