Sha256: c5ac1b2f1552aa9bc1f6fc5b36f741c6be2e9e1f12a11c6966b8d7f9e9d5bae5

Contents?: true

Size: 867 Bytes

Versions: 7

Compression:

Stored size: 867 Bytes

Contents

class Proxy
  attr_accessor :ip, :port, :username, :password, :status, :last_used, :user_agent, :burnout_time, :pages_before_burnout

  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

  def dead
    @status = 'dead'
    @last_used = Time.now
    @burnout_time = Time.now
  end

  def good
    @status = 'good'
    @last_used = Time.now
    @pages_before_burnout += 1
  end

  def good?
    @status == 'good' ? true : false
  end

  def dead?
    @status == 'dead' ? true : false
  end

  def used
    @last_used = Time.now
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
linsc-0.0.18 lib/linsc/proxy.rb
linsc-0.0.17 lib/linsc/proxy.rb
linsc-0.0.16 lib/linsc/proxy.rb
linsc-0.0.15 lib/linsc/proxy.rb
linsc-0.0.14 lib/linsc/proxy.rb
linsc-0.0.13 lib/linsc/proxy.rb
linsc-0.0.12 lib/linsc/proxy.rb