Class: Rollerskates::Application
- Defined in:
- lib/rollerskates/application.rb
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.
5 6 7 |
# File 'lib/rollerskates/application.rb', line 5 def initialize @routes = Routing::Router.new end |
Instance Attribute Details
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
3 4 5 |
# File 'lib/rollerskates/application.rb', line 3 def routes @routes end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/rollerskates/application.rb', line 9 def call(env) @request = Rack::Request.new(env) route = mapper.map_to_route(@request) if route response = route.dispatch return response.finish(route.method_name) end [404, {}, ["Route not found"]] end |