6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/hobber/renderer/tilt.rb', line 6
def render(path, data, context, vars, &block)
tilt_template_class = ::Tilt[path]
unless tilt_template_class
return data
end
template = tilt_template_class.new(path) { |t| data }
path = path.gsub(/\.\w+$/,'')
data = template.render(context, vars, &block)
render(path, data, context, vars, &block)
rescue => e
render_error = RenderError.new("#{self.class}: While rendering #{path} with #{tilt_template_class}: #{e.message}")
render_error.set_backtrace(e.backtrace)
raise render_error
end
|