Class: Proxy
- Inherits:
-
Object
- Object
- Proxy
- Defined in:
- lib/linsc/proxy.rb
Instance Attribute Summary collapse
-
#burnout_time ⇒ Object
Returns the value of attribute burnout_time.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#last_used ⇒ Object
Returns the value of attribute last_used.
-
#pages_before_burnout ⇒ Object
Returns the value of attribute pages_before_burnout.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#status ⇒ Object
Returns the value of attribute status.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #dead ⇒ Object
- #dead? ⇒ Boolean
- #good ⇒ Object
- #good? ⇒ Boolean
-
#initialize(ip:, port: 80, username: nil, password: nil, status: nil, last_used: nil, user_agent: nil, burnout_time: nil, pages_before_burnout: 0) ⇒ Proxy
constructor
A new instance of Proxy.
- #used ⇒ Object
Constructor Details
#initialize(ip:, port: 80, username: nil, password: nil, status: nil, last_used: nil, user_agent: nil, burnout_time: nil, pages_before_burnout: 0) ⇒ Proxy
Returns a new instance of Proxy.
4 5 6 7 |
# File 'lib/linsc/proxy.rb', line 4 def initialize(ip:, port: 80, username: nil, password: nil, status: nil, last_used: nil, user_agent: nil, burnout_time: nil, pages_before_burnout: 0) @ip, @port, @username, @password, @status, @last_used, @user_agent, @burnout_time, @pages_before_burnout = ip, port, username, password, status, last_used, user_agent, burnout_time, pages_before_burnout end |
Instance Attribute Details
#burnout_time ⇒ Object
Returns the value of attribute burnout_time.
2 3 4 |
# File 'lib/linsc/proxy.rb', line 2 def burnout_time @burnout_time end |
#ip ⇒ Object
Returns the value of attribute ip.
2 3 4 |
# File 'lib/linsc/proxy.rb', line 2 def ip @ip end |
#last_used ⇒ Object
Returns the value of attribute last_used.
2 3 4 |
# File 'lib/linsc/proxy.rb', line 2 def last_used @last_used end |
#pages_before_burnout ⇒ Object
Returns the value of attribute pages_before_burnout.
2 3 4 |
# File 'lib/linsc/proxy.rb', line 2 def pages_before_burnout @pages_before_burnout end |
#password ⇒ Object
Returns the value of attribute password.
2 3 4 |
# File 'lib/linsc/proxy.rb', line 2 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
2 3 4 |
# File 'lib/linsc/proxy.rb', line 2 def port @port end |
#status ⇒ Object
Returns the value of attribute status.
2 3 4 |
# File 'lib/linsc/proxy.rb', line 2 def status @status end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
2 3 4 |
# File 'lib/linsc/proxy.rb', line 2 def user_agent @user_agent end |
#username ⇒ Object
Returns the value of attribute username.
2 3 4 |
# File 'lib/linsc/proxy.rb', line 2 def username @username end |
Instance Method Details
#dead ⇒ Object
9 10 11 12 13 |
# File 'lib/linsc/proxy.rb', line 9 def dead @status = 'dead' @last_used = Time.now @burnout_time = Time.now end |
#dead? ⇒ Boolean
25 26 27 |
# File 'lib/linsc/proxy.rb', line 25 def dead? @status == 'dead' ? true : false end |
#good ⇒ Object
15 16 17 18 19 |
# File 'lib/linsc/proxy.rb', line 15 def good @status = 'good' @last_used = Time.now @pages_before_burnout += 1 end |
#good? ⇒ Boolean
21 22 23 |
# File 'lib/linsc/proxy.rb', line 21 def good? @status == 'good' ? true : false end |
#used ⇒ Object
29 30 31 |
# File 'lib/linsc/proxy.rb', line 29 def used @last_used = Time.now end |