Class: Tap::Controllers::App
Overview
:startdoc::controller dispatches signals to an app
Constant Summary
Tap::Controller::ServerError
Instance Attribute Summary
#request, #response, #server
Instance Method Summary
collapse
#action?, call, #call, #error, get, inherited, #initialize, #module_render, nest, #not_found, #redirect, #render, #render_erb, #render_layout, set, set_variables
Instance Method Details
#app ⇒ Object
39
40
41
|
# File 'lib/tap/controllers/app.rb', line 39
def app
server.app
end
|
#dispatch(route) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/tap/controllers/app.rb', line 14
def dispatch(route)
if route == "/"
return render('index.erb', :layout => true)
end
route =~ Tap::Parser::SIGNAL
signal = app.route($1, $2)
request_method = request.request_method
case request_method
when /GET/i
module_render('get.erb', signal)
when /POST/i
result = signal.call(request.params)
module_render('post.erb', signal, :locals => {:result => result})
else
error("cannot signal via: #{request_method}")
end
end
|
#route ⇒ Object
10
11
12
|
# File 'lib/tap/controllers/app.rb', line 10
def route
unescape(request.path_info)
end
|
#uri(obj, sig = nil) ⇒ Object
34
35
36
37
|
# File 'lib/tap/controllers/app.rb', line 34
def uri(obj, sig=nil)
obj, sig = nil, obj unless sig
super(obj ? "#{obj}/#{sig}" : sig)
end
|