Class: ExecJS::Rails::TemplateResolver

Inherits:
ActionView::Resolver
  • Object
show all
Defined in:
lib/execjs/rails/template_resolver.rb

Instance Method Summary collapse

Instance Method Details

#find_templates(name, prefix, partial, details) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/execjs/rails/template_resolver.rb', line 5

def find_templates(name, prefix, partial, details)
  path = "#{prefix}/#{name}"
  [::ActionView::Template.new(
    "<%= execjs_render('#{path}') %>",
    "ExecJS - #{path}",
    ActionView::Template.registered_template_handler(:erb),
    {
      format: Mime[:erb],
      virtual_path: path
    }
  )]
end