36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/luneta/park.rb', line 36
def call(env)
@output = ""
@routes.each do |route|
match = env['PATH_INFO'].match(route[:path])
if match
req = Rack::Request.new(env)
template = route[:template]
template = Dir.pwd + "/" + template
layout_template = route[:layout]
layout_template = Dir.pwd + "/" + layout_template
res = Rack::Response.new
if layout_template
layout = Luneta::Template.new(layout_template)
@output = layout.render(route[:title], route[:locals]) do
Luneta::Template.new(template).render(route[:title], route[:locals])
end
else
@output = Luneta::Template.new(template).render(route[:title], route[:locals])
end
res.write @output
res.finish
return res
end
end
end
|