Class: HttpRouter::Request
- Inherits:
-
Object
- Object
- HttpRouter::Request
- Defined in:
- lib/http_router/request.rb
Instance Attribute Summary collapse
-
#acceptance_test ⇒ Object
readonly
Returns the value of attribute acceptance_test.
-
#continue ⇒ Object
Returns the value of attribute continue.
-
#extra_env ⇒ Object
Returns the value of attribute extra_env.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
-
#rack_request ⇒ Object
(also: #rack)
Returns the value of attribute rack_request.
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(path, rack_request, perform_call, &acceptance_test) ⇒ Request
constructor
A new instance of Request.
- #joined_path ⇒ Object
- #perform_call ⇒ Object
- #testing_405? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(path, rack_request, perform_call, &acceptance_test) ⇒ Request
Returns a new instance of Request.
6 7 8 9 10 11 12 |
# File 'lib/http_router/request.rb', line 6 def initialize(path, rack_request, perform_call, &acceptance_test) @rack_request, @perform_call, @acceptance_test = rack_request, perform_call, acceptance_test @path = (path[0] == ?/ ? path[1, path.size] : path).split(/\//) @path << '' if path.size > 1 && path[-1] == ?/ @extra_env = {} @params = [] end |
Instance Attribute Details
#acceptance_test ⇒ Object (readonly)
Returns the value of attribute acceptance_test.
3 4 5 |
# File 'lib/http_router/request.rb', line 3 def acceptance_test @acceptance_test end |
#continue ⇒ Object
Returns the value of attribute continue.
4 5 6 |
# File 'lib/http_router/request.rb', line 4 def continue @continue end |
#extra_env ⇒ Object
Returns the value of attribute extra_env.
4 5 6 |
# File 'lib/http_router/request.rb', line 4 def extra_env @extra_env end |
#params ⇒ Object
Returns the value of attribute params.
4 5 6 |
# File 'lib/http_router/request.rb', line 4 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/http_router/request.rb', line 4 def path @path end |
#rack_request ⇒ Object Also known as: rack
Returns the value of attribute rack_request.
4 5 6 |
# File 'lib/http_router/request.rb', line 4 def rack_request @rack_request end |
Instance Method Details
#clone ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/http_router/request.rb', line 30 def clone dup_obj = super dup_obj.path = path.dup dup_obj.params = params.dup dup_obj.extra_env = extra_env.dup dup_obj end |
#joined_path ⇒ Object
14 15 16 |
# File 'lib/http_router/request.rb', line 14 def joined_path @path * '/' end |
#perform_call ⇒ Object
18 19 20 |
# File 'lib/http_router/request.rb', line 18 def perform_call @perform_call == true end |
#testing_405? ⇒ Boolean
22 23 24 |
# File 'lib/http_router/request.rb', line 22 def testing_405? @perform_call == 405 end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/http_router/request.rb', line 26 def to_s "request path, #{path.inspect}" end |