Class: Templater::Actions::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/middleman/templater+dynamic_renderer.rb

Instance Method Summary collapse

Instance Method Details

#renderObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/middleman/templater+dynamic_renderer.rb', line 16

def render
  @@rack_test ||= Rack::Test::Session.new(Rack::MockSession.new(Middleman::Server))
  
  @render_cache ||= begin
    # The default render just requests the page over Rack and writes the response
    request_path = destination.gsub(File.join(Dir.pwd, Middleman::Server.build_dir), "")
    @@rack_test.get(request_path)
    @@rack_test.last_response.body
  end
end