Class: WebConsole::Template

Inherits:
Object
  • Object
show all
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.

Instance Method Summary collapse

Constructor Details

#initialize(env, session) ⇒ Template

Returns a new instance of Template.



12
13
14
15
16
# File 'lib/web_console/template.rb', line 12

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.



19
20
21
22
# File 'lib/web_console/template.rb', line 19

def render(template)
  view = View.with_empty_template_cache.with_view_paths(template_paths, instance_values)
  view.render(template: template, layout: false)
end