Class: Grape::Middleware::Prefixer
- Defined in:
- lib/grape/middleware/prefixer.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#after, #call, #call!, #content_type, #content_types, #default_options, #initialize, #mime_types, #request, #response
Constructor Details
This class inherits a constructor from Grape::Middleware::Base
Instance Method Details
#before ⇒ Object
13 14 15 16 17 18 |
# File 'lib/grape/middleware/prefixer.rb', line 13 def before if env['PATH_INFO'].index(prefix) == 0 env['PATH_INFO'].sub!(prefix, '') env['PATH_INFO'] = Rack::Mount::Utils.normalize_path(env['PATH_INFO']) end end |
#prefix ⇒ Object
7 8 9 10 11 |
# File 'lib/grape/middleware/prefixer.rb', line 7 def prefix prefix = [:prefix] || "" prefix = Rack::Mount::Utils.normalize_path(prefix) prefix end |