Class: Plezi::Base::RouteRewrite

Inherits:
Route
  • Object
show all
Defined in:
lib/plezi/router/route.rb

Instance Attribute Summary

Attributes inherited from Route

#controller, #param_names, #prefix

Instance Method Summary collapse

Methods inherited from Route

#fits_params, #initialize, #match, #prep_controller, #prep_params, qp

Constructor Details

This class inherits a constructor from Plezi::Base::Route

Instance Method Details

#call(request, _response) ⇒ Object



103
104
105
106
107
108
109
110
# File 'lib/plezi/router/route.rb', line 103

def call(request, _response)
   return nil unless match(request.path_info, request)
   params = Thread.current[@route_id]
   return nil unless controller =~ params[@param_names[0]]
   request.path_info = "/#{params.delete('*'.freeze).to_a.join '/'}"
   request.params.update params
   nil
end