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.
Defined Under Namespace
Classes: Context
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.
| 38 39 40 41 | # File 'lib/web_console/template.rb', line 38 def initialize(env, session) @env = env @session = session end | 
Instance Method Details
#render(template) ⇒ Object
Render a template (inferred from template_paths) as a plain string.
| 44 45 46 47 | # File 'lib/web_console/template.rb', line 44 def render(template) context = Context.new(template_paths, instance_values) context.render(template: template, layout: false) end |