Class: Mgt::Application
Instance Attribute Summary collapse
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #mapper ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
16 17 18 |
# File 'lib/mgt.rb', line 16 def initialize @routes = Routing::Router.new end |
Instance Attribute Details
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
14 15 16 |
# File 'lib/mgt.rb', line 14 def routes @routes end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mgt.rb', line 20 def call(env) @request = Rack::Request.new(env) route = mapper.map_to_route(@request) if route route.dispatch else [404, {}, ["Page not found"]] end end |