Class: WebConsole::Template
- Inherits:
-
Object
- Object
- WebConsole::Template
- Defined in:
- lib/web_console/template.rb
Overview
A facade that handles template rendering and composition.
It introduces template helpers to ease the inclusion of scripts only on Rails error pages.
Constant Summary collapse
- @@template_paths =
[ File.('../templates', __FILE__) ]
Instance Method Summary collapse
-
#initialize(env, session) ⇒ Template
constructor
A new instance of Template.
-
#render(template) ⇒ Object
Render a template (inferred from
template_paths
) as a plain string.
Constructor Details
#initialize(env, session) ⇒ Template
Returns a new instance of Template.
11 12 13 14 15 |
# File 'lib/web_console/template.rb', line 11 def initialize(env, session) @env = env @session = session @mount_point = Middleware.mount_point end |
Instance Method Details
#render(template) ⇒ Object
Render a template (inferred from template_paths
) as a plain string.
18 19 20 21 |
# File 'lib/web_console/template.rb', line 18 def render(template) view = View.new(template_paths, instance_values) view.render(template: template, layout: false) end |