Class: Rack::Mount::Request
- Inherits:
-
Object
- Object
- Rack::Mount::Request
- Defined in:
- lib/rack/mount/request.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(env) ⇒ Request
constructor
A new instance of Request.
- #method ⇒ Object
- #path ⇒ Object
- #path_keys ⇒ Object
- #path_keys_at(index) ⇒ Object
Constructor Details
#initialize(env) ⇒ Request
Returns a new instance of Request.
4 5 6 |
# File 'lib/rack/mount/request.rb', line 4 def initialize(env) @env = env end |
Instance Method Details
#method ⇒ Object
8 9 10 |
# File 'lib/rack/mount/request.rb', line 8 def method @method ||= @env[Const::REQUEST_METHOD] || Const::GET end |
#path ⇒ Object
12 13 14 |
# File 'lib/rack/mount/request.rb', line 12 def path @path ||= @env[Const::PATH_INFO] || Const::SLASH end |
#path_keys ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/rack/mount/request.rb', line 20 def path_keys @path_keys ||= begin keys = path.split(%r{/|\.|\?}) keys.shift keys << Const::EOS_KEY keys end end |
#path_keys_at(index) ⇒ Object
16 17 18 |
# File 'lib/rack/mount/request.rb', line 16 def path_keys_at(index) path_keys[index] end |