Class: ActionviewPrecompiler::TemplateLoader
- Inherits:
-
Object
- Object
- ActionviewPrecompiler::TemplateLoader
- Defined in:
- lib/actionview_precompiler/template_loader.rb
Constant Summary collapse
- VIRTUAL_PATH_REGEX =
%r{\A(?:(?<prefix>.*)\/)?(?<partial>_)?(?<action>[^\/\.]+)}
Instance Method Summary collapse
-
#initialize ⇒ TemplateLoader
constructor
A new instance of TemplateLoader.
- #load_template(virtual_path, locals) ⇒ Object
Constructor Details
#initialize ⇒ TemplateLoader
Returns a new instance of TemplateLoader.
5 6 7 8 9 |
# File 'lib/actionview_precompiler/template_loader.rb', line 5 def initialize target = ActionController::Base @lookup_context = ActionView::LookupContext.new(target.view_paths) @view_context_class = target.view_context_class end |
Instance Method Details
#load_template(virtual_path, locals) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/actionview_precompiler/template_loader.rb', line 11 def load_template(virtual_path, locals) templates = find_all_templates(virtual_path, locals) templates.each do |template| template.send(:compile!, @view_context_class) end end |