Class: Sidewalk::TemplateHandlers::ErbHandler::Delegate

Inherits:
BaseDelegate
  • Object
show all
Includes:
ERB::Util
Defined in:
lib/sidewalk/template_handlers/erb_handler.rb

Overview

Class representing the controller to ERB.

Using a delegate so we can add extra methods to the binding without polluting the class - for example, most people expect an ERB template to have access to ERB::Util#h

Instance Method Summary collapse

Constructor Details

#initialize(template, controller) ⇒ Delegate

Returns a new instance of Delegate.



29
30
31
32
# File 'lib/sidewalk/template_handlers/erb_handler.rb', line 29

def initialize template, controller
  @template = template
  super controller
end

Instance Method Details

#renderObject



34
35
36
# File 'lib/sidewalk/template_handlers/erb_handler.rb', line 34

def render
  @template.result binding
end