Class: Rambo::Request
- Inherits:
-
Rack::Request
- Object
- Rack::Request
- Rambo::Request
- Defined in:
- lib/rambo/request.rb
Instance Method Summary collapse
-
#accept ⇒ Object
Returns an array of acceptable media types for the response.
- #action ⇒ Object
- #controller ⇒ Object
- #default_controller ⇒ Object
-
#params ⇒ Object
Override Rack 0.9.x’s #params implementation (see #72 in lighthouse).
- #path ⇒ Object
- #path_components ⇒ Object
- #uri ⇒ Object
- #user_agent ⇒ Object
Instance Method Details
#accept ⇒ Object
Returns an array of acceptable media types for the response
8 9 10 |
# File 'lib/rambo/request.rb', line 8 def accept @env['HTTP_ACCEPT'].to_s.split(',').map { |a| a.strip } end |
#action ⇒ Object
36 37 38 |
# File 'lib/rambo/request.rb', line 36 def action path_components[2] || 'index' end |
#controller ⇒ Object
32 33 34 |
# File 'lib/rambo/request.rb', line 32 def controller path_components[1] || default_controller end |
#default_controller ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/rambo/request.rb', line 24 def default_controller if Rambo::Env.config['rambo'] Rambo::Env.config['rambo']['default_controller'] || 'home' else 'home' end end |
#params ⇒ Object
Override Rack 0.9.x’s #params implementation (see #72 in lighthouse)
41 42 43 44 45 |
# File 'lib/rambo/request.rb', line 41 def params self.GET.update(self.POST) rescue EOFError => boom self.GET end |
#path ⇒ Object
12 13 14 |
# File 'lib/rambo/request.rb', line 12 def path env["REQUEST_PATH"] end |
#path_components ⇒ Object
20 21 22 |
# File 'lib/rambo/request.rb', line 20 def path_components @path_components ||= path.split('/') end |
#uri ⇒ Object
16 17 18 |
# File 'lib/rambo/request.rb', line 16 def uri env["REQUEST_URI"] end |
#user_agent ⇒ Object
3 4 5 |
# File 'lib/rambo/request.rb', line 3 def user_agent @env['HTTP_USER_AGENT'] end |