Module: Rack::App::FrontEnd::EndpointMethods

Defined in:
lib/rack/app/front_end/endpoint_methods.rb

Instance Method Summary collapse

Instance Method Details

#render(template_path, variables = {}, options = {}, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/rack/app/front_end/endpoint_methods.rb', line 3

def render(template_path, variables={}, options={}, &block)
  options = {:layout_path => self.class.layout}.merge(options)

  scope = Rack::App::FrontEnd::Template::Scope.new
  scope.extend(self.class.helpers)
  Rack::App::FrontEnd::Utils.link_instance_variables(self, scope)

  full_path = Rack::App::Utils.expand_path(template_path)
  template = Rack::App::FrontEnd::Template.new(full_path, options)

  return template.render(scope, variables, &block)
end