Class: Mippin::Application
- Inherits:
-
Object
- Object
- Mippin::Application
- Defined in:
- lib/mippin/application.rb
Overview
Rack application that serves the Jekyll site.
Not to be instantiated directly, use Mippin.application instead.
Instance Attribute Summary collapse
-
#router ⇒ Object
readonly
Returns the value of attribute router.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(router) ⇒ Application
constructor
A new instance of Application.
Constructor Details
#initialize(router) ⇒ Application
Returns a new instance of Application.
15 16 17 |
# File 'lib/mippin/application.rb', line 15 def initialize(router) @router = router end |
Instance Attribute Details
#router ⇒ Object (readonly)
Returns the value of attribute router.
13 14 15 |
# File 'lib/mippin/application.rb', line 13 def router @router end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/mippin/application.rb', line 19 def call(env) request = Rack::Request.new(env) endpoint = router.endpoint(request.path_info) case endpoint when :not_found not_found_response when :must_redirect redirect_to_dir_response(request.path_info) else case request.request_method when "HEAD", "GET" response(endpoint) when "OPTIONS" [200, { "Allow" => "GET,HEAD,OPTIONS", "Content-Length" => "0" }, []] else not_allowed_response end end end |