Class: HttpRouter::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/http_router/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, rack_request, perform_call) ⇒ Request

Returns a new instance of Request.



5
6
7
8
9
10
11
# File 'lib/http_router/request.rb', line 5

def initialize(path, rack_request, perform_call)
  @rack_request, @perform_call = rack_request, perform_call
  @path = (path[0] == ?/ ? path[1, path.size] : path).split(/\//)
  @path << '' if path.size > 1 && path[-1] == ?/
  @extra_env = {}
  @params = []
end

Instance Attribute Details

#continueObject

Returns the value of attribute continue.



3
4
5
# File 'lib/http_router/request.rb', line 3

def continue
  @continue
end

#extra_envObject

Returns the value of attribute extra_env.



3
4
5
# File 'lib/http_router/request.rb', line 3

def extra_env
  @extra_env
end

#paramsObject

Returns the value of attribute params.



3
4
5
# File 'lib/http_router/request.rb', line 3

def params
  @params
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/http_router/request.rb', line 3

def path
  @path
end

#rack_requestObject 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

#cloneObject



25
26
27
28
29
30
31
# File 'lib/http_router/request.rb', line 25

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

#perform_callObject



13
14
15
# File 'lib/http_router/request.rb', line 13

def perform_call
  @perform_call == true
end

#testing_405?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/http_router/request.rb', line 17

def testing_405?
  @perform_call == 405
end

#to_sObject



21
22
23
# File 'lib/http_router/request.rb', line 21

def to_s
  "request path, #{path.inspect}"
end