Class: Spider::Request
Direct Known Subclasses
Constant Summary collapse
- BUFSIZE =
1024*4
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#controller_path ⇒ Object
Returns the value of attribute controller_path.
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#env ⇒ Object
Returns the value of attribute env.
-
#format ⇒ Object
Returns the value of attribute format.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#misc ⇒ Object
Returns the value of attribute misc.
-
#params ⇒ Object
Returns the value of attribute params.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#request_time ⇒ Object
Returns the value of attribute request_time.
-
#server ⇒ Object
Returns the value of attribute server.
-
#session ⇒ Object
Returns the value of attribute session.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Class Method Summary collapse
Instance Method Summary collapse
- #body ⇒ Object
- #body=(b) ⇒ Object
-
#initialize(env) ⇒ Request
constructor
A new instance of Request.
-
#path ⇒ Object
Original request path.
- #read_body ⇒ Object
Constructor Details
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def action @action end |
#controller_path ⇒ Object
Returns the value of attribute controller_path.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def controller_path @controller_path end |
#cookies ⇒ Object
Returns the value of attribute cookies.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def @cookies end |
#env ⇒ Object
Returns the value of attribute env.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def env @env end |
#format ⇒ Object
Returns the value of attribute format.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def format @format end |
#locale ⇒ Object
Returns the value of attribute locale.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def locale @locale end |
#misc ⇒ Object
Returns the value of attribute misc.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def misc @misc end |
#params ⇒ Object
Returns the value of attribute params.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def params @params end |
#protocol ⇒ Object
Returns the value of attribute protocol.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def protocol @protocol end |
#request_time ⇒ Object
Returns the value of attribute request_time.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def request_time @request_time end |
#server ⇒ Object
Returns the value of attribute server.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def server @server end |
#session ⇒ Object
Returns the value of attribute session.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def session @session end |
#user_id ⇒ Object
Returns the value of attribute user_id.
4 5 6 |
# File 'lib/spiderfw/controller/request.rb', line 4 def user_id @user_id end |
Class Method Details
.current ⇒ Object
10 11 12 |
# File 'lib/spiderfw/controller/request.rb', line 10 def self.current Thread.current[:spider_request] ||= {} end |
.current=(val) ⇒ Object
14 15 16 |
# File 'lib/spiderfw/controller/request.rb', line 14 def self.current=(val) Thread.current[:spider_request] = val end |
.reset_current ⇒ Object
18 19 20 |
# File 'lib/spiderfw/controller/request.rb', line 18 def self.reset_current Thread.current[:spider_request] = nil end |
Instance Method Details
#body ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/spiderfw/controller/request.rb', line 36 def body b = @body.is_a?(String) ? StringIO.new(@body) : @body return nil unless b if block_given? b.rewind while (buf = b.read(BUFSIZE)) yield buf end end return b end |
#body=(b) ⇒ Object
32 33 34 |
# File 'lib/spiderfw/controller/request.rb', line 32 def body=(b) @body = b end |
#path ⇒ Object
Original request path
59 60 61 |
# File 'lib/spiderfw/controller/request.rb', line 59 def path @action end |