Class: Rack::Mount::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/mount/request.rb

Overview

:nodoc:

Instance Method Summary collapse

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

#methodObject



8
9
10
# File 'lib/rack/mount/request.rb', line 8

def method
  @method ||= @env[Const::REQUEST_METHOD] || Const::GET
end

#pathObject



12
13
14
# File 'lib/rack/mount/request.rb', line 12

def path
  @path ||= @env[Const::PATH_INFO] || Const::SLASH
end

#path_keysObject



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