Class: Spidr::Proxy

Inherits:
Struct
  • Object
show all
Defined in:
lib/spidr/proxy.rb

Overview

Since:

  • 0.6.0

Constant Summary collapse

DEFAULT_PORT =

Default port to use.

Since:

  • 0.6.0

8080

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host: nil, port: DEFAULT_PORT, user: nil, password: nil) ⇒ Proxy

Initializes the proxy.

Parameters:

  • host (String) (defaults to: nil)

    The host the proxy is running on.

  • port (Integer) (defaults to: DEFAULT_PORT)

    The port the proxy is running on.

  • user (String) (defaults to: nil)

    The user to authenticate as with the proxy.

  • password (String) (defaults to: nil)

    The password to authenticate with.

Since:

  • 0.6.0



27
28
29
# File 'lib/spidr/proxy.rb', line 27

def initialize(host: nil, port: DEFAULT_PORT, user: nil, password: nil)
  super(host,port,user,password)
end

Instance Attribute Details

#hostObject

Returns the value of attribute host

Returns:

  • (Object)

    the current value of host



7
8
9
# File 'lib/spidr/proxy.rb', line 7

def host
  @host
end

#passwordObject

Returns the value of attribute password

Returns:

  • (Object)

    the current value of password



7
8
9
# File 'lib/spidr/proxy.rb', line 7

def password
  @password
end

#portObject

Returns the value of attribute port

Returns:

  • (Object)

    the current value of port



7
8
9
# File 'lib/spidr/proxy.rb', line 7

def port
  @port
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



7
8
9
# File 'lib/spidr/proxy.rb', line 7

def user
  @user
end

Instance Method Details

#disabled?Boolean

Determines if the proxy is not set.

Returns:

  • (Boolean)

Since:

  • 0.6.0



45
46
47
# File 'lib/spidr/proxy.rb', line 45

def disabled?
  host.nil?
end

#enabled?Boolean

Determines if the proxy settings are set.

Returns:

  • (Boolean)

Since:

  • 0.6.0



36
37
38
# File 'lib/spidr/proxy.rb', line 36

def enabled?
  !host.nil?
end