Class: Mutx::Support::Request
- Inherits:
-
Object
- Object
- Mutx::Support::Request
show all
- Defined in:
- lib/mutx/support/request.rb
Instance Method Summary
collapse
Constructor Details
#initialize(req) ⇒ Request
Returns a new instance of Request.
6
7
8
|
# File 'lib/mutx/support/request.rb', line 6
def initialize req
@req = req
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/mutx/support/request.rb', line 26
def method_missing(method_name, *args, &block)
begin
send("@req.#{method_name}", *args)
rescue
Mutx::Support::Log.error "#{method_name} not found for req in #{self.class}. Returning nil"
nil
end
end
|
Instance Method Details
#ip ⇒ Object
18
19
20
|
# File 'lib/mutx/support/request.rb', line 18
def ip
@req.env["REMOTE_ADDR"]
end
|
#path ⇒ Object
10
11
12
|
# File 'lib/mutx/support/request.rb', line 10
def path
self.path_info
end
|
#path_info ⇒ Object
14
15
16
|
# File 'lib/mutx/support/request.rb', line 14
def path_info
@req.env["PATH_INFO"]
end
|
#request ⇒ Object
22
23
24
|
# File 'lib/mutx/support/request.rb', line 22
def request
@req.env
end
|