class Tansu::Application
Public Instance Methods
call(env)
click to toggle source
# File lib/tansu/application.rb, line 5 def call(env) Application[:before].() if Application[:before] response = action(env) Application[:after].() if Application[:after] response end
Private Instance Methods
action(env)
click to toggle source
# File lib/tansu/application.rb, line 17 def action(env) request = Rack::Request.new(env) environment = Environment.new(request, Response.new) path = (path = environment.params[:path_info]).empty? ? [:index] : path router = path.inject(Tansu.root) { |a, e| a[e] }[request.request_method] if Minicontext::Router::Just === router response = router.value.(environment).response Response === response ? response.finish : internal_server_error else not_found end end
internal_server_error()
click to toggle source
# File lib/tansu/application.rb, line 33 def internal_server_error ['500', { 'Context-Type' => 'text/html' }, ['internal server error.']] end
not_found()
click to toggle source
# File lib/tansu/application.rb, line 37 def not_found ['404', { 'Context-Type' => 'text/html' }, ['not found.']] end