Class: HttpRouter::Request
- Inherits:
-
Object
- Object
- HttpRouter::Request
- Defined in:
- lib/http_router/request.rb
Instance Attribute Summary collapse
-
#continue ⇒ Object
Returns the value of attribute continue.
-
#extra_env ⇒ Object
Returns the value of attribute extra_env.
-
#matches ⇒ Object
readonly
Returns the value of attribute matches.
-
#params ⇒ Object
Returns the value of attribute params.
-
#passed_with ⇒ Object
Returns the value of attribute passed_with.
-
#path ⇒ Object
Returns the value of attribute path.
-
#rack_request ⇒ Object
(also: #rack)
Returns the value of attribute rack_request.
Instance Method Summary collapse
-
#initialize(path, rack_request, perform_call) ⇒ Request
constructor
A new instance of Request.
- #joined_path ⇒ Object
- #matched_route(response) ⇒ Object
- #path_finished? ⇒ Boolean
- #perform_call ⇒ Object
- #testing_405? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(path, rack_request, perform_call) ⇒ Request
Returns a new instance of Request.
6 7 8 9 10 11 12 13 14 |
# File 'lib/http_router/request.rb', line 6 def initialize(path, rack_request, perform_call) @rack_request, @perform_call = rack_request, perform_call @path = URI.unescape(path).split(/\//) @path.shift if @path.first == '' @path.push('') if path[-1] == ?/ @extra_env = {} @params = [] @matches = [] end |
Instance Attribute Details
#continue ⇒ Object
Returns the value of attribute continue.
3 4 5 |
# File 'lib/http_router/request.rb', line 3 def continue @continue end |
#extra_env ⇒ Object
Returns the value of attribute extra_env.
3 4 5 |
# File 'lib/http_router/request.rb', line 3 def extra_env @extra_env end |
#matches ⇒ Object (readonly)
Returns the value of attribute matches.
4 5 6 |
# File 'lib/http_router/request.rb', line 4 def matches @matches end |
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/http_router/request.rb', line 3 def params @params end |
#passed_with ⇒ Object
Returns the value of attribute passed_with.
3 4 5 |
# File 'lib/http_router/request.rb', line 3 def passed_with @passed_with end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/http_router/request.rb', line 3 def path @path end |
#rack_request ⇒ Object Also known as: rack
Returns the value of attribute rack_request.
3 4 5 |
# File 'lib/http_router/request.rb', line 3 def rack_request @rack_request end |
Instance Method Details
#joined_path ⇒ Object
16 17 18 |
# File 'lib/http_router/request.rb', line 16 def joined_path @path * '/' end |
#matched_route(response) ⇒ Object
20 21 22 |
# File 'lib/http_router/request.rb', line 20 def matched_route(response) @matches << response end |
#path_finished? ⇒ Boolean
36 37 38 |
# File 'lib/http_router/request.rb', line 36 def path_finished? @path.size == 0 or @path.size == 1 && @path.first == '' end |
#perform_call ⇒ Object
24 25 26 |
# File 'lib/http_router/request.rb', line 24 def perform_call @perform_call == true end |
#testing_405? ⇒ Boolean
28 29 30 |
# File 'lib/http_router/request.rb', line 28 def testing_405? @perform_call == 405 end |
#to_s ⇒ Object
32 33 34 |
# File 'lib/http_router/request.rb', line 32 def to_s "request path, #{path.inspect}" end |