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.
49
50
51
|
# File 'lib/http_double/request_logger.rb', line 49
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
71
72
73
|
# File 'lib/http_double/request_logger.rb', line 71
def method_missing(sym, *args, &block)
parsed_input.__send__ sym, *args, &block
end
|
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
47
48
49
|
# File 'lib/http_double/request_logger.rb', line 47
def env
@env
end
|
Instance Method Details
#[](field, index = nil) ⇒ Object
65
66
67
68
69
|
# File 'lib/http_double/request_logger.rb', line 65
def [](field, index = nil)
result = parsed_input[field]
result = result[index] if result and index
result
end
|
#body ⇒ Object
53
54
55
|
# File 'lib/http_double/request_logger.rb', line 53
def body
@body ||= rack_input.rewind && rack_input.read
end
|
#path ⇒ Object
61
62
63
|
# File 'lib/http_double/request_logger.rb', line 61
def path
env['REQUEST_PATH']
end
|
#respond_to_missing?(sym) ⇒ Boolean
75
76
77
|
# File 'lib/http_double/request_logger.rb', line 75
def respond_to_missing?(sym)
parsed_input.respond_to? sym
end
|
#verb ⇒ Object
57
58
59
|
# File 'lib/http_double/request_logger.rb', line 57
def verb
env['REQUEST_METHOD'].downcase.to_sym
end
|