Class: HttpDouble::RequestLogger::Request
- Inherits:
-
Object
- Object
- HttpDouble::RequestLogger::Request
show all
- Defined in:
- lib/http_double/request_logger.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(env) ⇒ Request
Returns a new instance of Request.
30
31
32
|
# File 'lib/http_double/request_logger.rb', line 30
def initialize(env)
@env = env
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
52
53
54
|
# File 'lib/http_double/request_logger.rb', line 52
def method_missing(sym, *args, &block)
parsed_input.__send__ sym, *args, &block
end
|
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
28
29
30
|
# File 'lib/http_double/request_logger.rb', line 28
def env
@env
end
|
Instance Method Details
#[](field, index = nil) ⇒ Object
46
47
48
49
50
|
# File 'lib/http_double/request_logger.rb', line 46
def [](field, index = nil)
result = parsed_input[field]
result = result[index] if result and index
result
end
|
#body ⇒ Object
34
35
36
|
# File 'lib/http_double/request_logger.rb', line 34
def body
@body ||= rack_input.rewind && rack_input.read
end
|
#path ⇒ Object
42
43
44
|
# File 'lib/http_double/request_logger.rb', line 42
def path
env['REQUEST_PATH']
end
|
#respond_to_missing?(sym) ⇒ Boolean
56
57
58
|
# File 'lib/http_double/request_logger.rb', line 56
def respond_to_missing?(sym)
parsed_input.respond_to? sym
end
|
#verb ⇒ Object
38
39
40
|
# File 'lib/http_double/request_logger.rb', line 38
def verb
env['REQUEST_METHOD'].downcase.to_sym
end
|