12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/merbiful-release/body.rb', line 12
def render(controller, caches = {})
rval = if self.filter.blank?
self.body
else
controller.send(Merb::Template::METHOD_LIST[render_id] ||=
begin
filter = Merb::Template::EXTENSIONS[self.filter]
if filter.method(:compile_template).arity == 3
filter.compile_template(FAKE_IO_CLASS.new(self.body, render_id),
render_id,
Merb::InlineTemplates)
elsif filter.method(:compile_template).arity == 4
filter.compile_template(FAKE_IO_CLASS.new(self.body, render_id),
render_id,
[],
Merb::InlineTemplates)
end
end)
end
unless Merb.environment == "development"
caches.each do |destination, to_cache|
if to_cache
path = destination.cached_path
Merb.logger.info("Flushing to #{path.inspect}")
path.parent.mkpath
path.open("w") do |out|
out.write(rval)
end
end
end
end
return rval
end
|