class RackDispatch::TemplateDestination

Public Class Methods

new(path) click to toggle source
# File lib/rack_dispatch/template_destination.rb, line 3
def initialize(path)
  @path = File.expand_path(File.join('templates', String(path)), Dir.pwd) + '.liquid'
end

Public Instance Methods

call(request, response) click to toggle source
# File lib/rack_dispatch/template_destination.rb, line 7
def call(request, response)
  response['Content-Type'] = 'text/html'
  response.write(render(request.params))
end
render(data = {}) click to toggle source
# File lib/rack_dispatch/template_destination.rb, line 12
def render(data = {})
  Liquid::Template.parse(File.read(@path)).render(data)
end