Class: Track::Controller
- Inherits:
-
Object
- Object
- Track::Controller
- Defined in:
- lib/track/controller.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize ⇒ Controller
constructor
A new instance of Controller.
Constructor Details
#initialize ⇒ Controller
Returns a new instance of Controller.
13 14 15 |
# File 'lib/track/controller.rb', line 13 def initialize @params = {} end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
11 12 13 |
# File 'lib/track/controller.rb', line 11 def params @params end |
Instance Method Details
#call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/track/controller.rb', line 17 def call(env) req = Rack::Request.new(env) @params.merge!(req.params) if route = @@route_map.scan(self.class.name, req) @params.merge!(route[:matches]) response_for(route) else routing_error end end |