Class: PhantomJSProxy::PhantomJSControlPanel
- Inherits:
-
Object
- Object
- PhantomJSProxy::PhantomJSControlPanel
- Defined in:
- lib/phantom_proxy/phantomjs_control_panel.rb
Instance Attribute Summary collapse
-
#html_requests ⇒ Object
Returns the value of attribute html_requests.
-
#picture_requests ⇒ Object
Returns the value of attribute picture_requests.
-
#route_requests ⇒ Object
Returns the value of attribute route_requests.
-
#special_requests ⇒ Object
Returns the value of attribute special_requests.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#total_requests ⇒ Object
Returns the value of attribute total_requests.
Instance Method Summary collapse
- #add_request ⇒ Object
- #add_special_request(type) ⇒ Object
-
#initialize ⇒ PhantomJSControlPanel
constructor
A new instance of PhantomJSControlPanel.
- #show ⇒ Object
Constructor Details
#initialize ⇒ PhantomJSControlPanel
Returns a new instance of PhantomJSControlPanel.
3 4 5 6 7 8 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 3 def initialize @start_time = Time.new @total_requests = 0 @special_requests = Hash.new @special_requests.default = 0 end |
Instance Attribute Details
#html_requests ⇒ Object
Returns the value of attribute html_requests.
14 15 16 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 14 def html_requests @html_requests end |
#picture_requests ⇒ Object
Returns the value of attribute picture_requests.
15 16 17 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 15 def picture_requests @picture_requests end |
#route_requests ⇒ Object
Returns the value of attribute route_requests.
13 14 15 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 13 def route_requests @route_requests end |
#special_requests ⇒ Object
Returns the value of attribute special_requests.
16 17 18 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 16 def special_requests @special_requests end |
#start_time ⇒ Object
Returns the value of attribute start_time.
10 11 12 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 10 def start_time @start_time end |
#total_requests ⇒ Object
Returns the value of attribute total_requests.
12 13 14 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 12 def total_requests @total_requests end |
Instance Method Details
#add_request ⇒ Object
29 30 31 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 29 def add_request @total_requests = @total_requests+1 end |
#add_special_request(type) ⇒ Object
33 34 35 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 33 def add_special_request type @special_requests[type] = @special_requests[type]+1 end |
#show ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/phantom_proxy/phantomjs_control_panel.rb', line 18 def show add_special_request "@control_requests" resp = Rack::Response.new([], 200, { 'Content-Type' => 'text/html' }) { |r| r.write(load_html) } resp.finish end |