Class: HttpRouter::Request
- Inherits:
-
Object
- Object
- HttpRouter::Request
- Defined in:
- lib/http_router/request.rb
Instance Attribute Summary collapse
-
#acceptable_methods ⇒ Object
readonly
Returns the value of attribute acceptable_methods.
-
#called ⇒ Object
(also: #called?)
Returns the value of attribute called.
-
#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.
-
#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) ⇒ Request
constructor
A new instance of Request.
- #joined_path ⇒ Object
- #path_finished? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(path, rack_request) ⇒ Request
Returns a new instance of Request.
8 9 10 11 12 13 14 15 16 |
# File 'lib/http_router/request.rb', line 8 def initialize(path, rack_request) @rack_request = rack_request @path = URI.unescape(path).split(/\//) @path.shift if @path.first == '' @path.push('') if path[-1] == ?/ @extra_env = {} @params = [] @acceptable_methods = Set.new end |
Instance Attribute Details
#acceptable_methods ⇒ Object (readonly)
Returns the value of attribute acceptable_methods.
4 5 6 |
# File 'lib/http_router/request.rb', line 4 def acceptable_methods @acceptable_methods end |
#called ⇒ Object Also known as: called?
Returns the value of attribute called.
3 4 5 |
# File 'lib/http_router/request.rb', line 3 def called @called end |
#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 |
#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
18 19 20 |
# File 'lib/http_router/request.rb', line 18 def joined_path @path * '/' end |
#path_finished? ⇒ Boolean
26 27 28 |
# File 'lib/http_router/request.rb', line 26 def path_finished? @path.size == 0 or @path.size == 1 && @path.first == '' end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/http_router/request.rb', line 22 def to_s "request path, #{path.inspect}" end |