class Pup::Application
Attributes
path[R]
request[R]
router[R]
routes[R]
verb[R]
Public Class Methods
new()
click to toggle source
# File lib/pup/application.rb, line 11 def initialize @router = Routing::Router.new end
Public Instance Methods
call(env)
click to toggle source
# File lib/pup/application.rb, line 15 def call(env) env = MethodOverride.apply_to(env) @request = Rack::Request.new(env) if router.has_routes? respond_to_request else pup_default_response end end
Private Instance Methods
page_not_found()
click to toggle source
# File lib/pup/application.rb, line 44 def page_not_found Rack::Response.new( "<center><h1>404 Error</h1>Page not found</center>", 404, "Content-Type" => "text/html" ) end
pup_default_response()
click to toggle source
# File lib/pup/application.rb, line 36 def pup_default_response Rack::Response.new( "<center><b>Pup ::: </b>MVC Framework for web masters</center>", 200, "Content-Type" => "text/html" ) end
respond_to_request()
click to toggle source
# File lib/pup/application.rb, line 26 def respond_to_request route = router.get_match(request.request_method, request.path_info) if route handler = RequestHandler.new(request, route) handler.response else page_not_found end end