Class: TorPrivoxy::Switcher

Inherits:
Object
  • Object
show all
Defined in:
lib/tor-privoxy/switcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, pass, control) ⇒ Switcher

Returns a new instance of Switcher.



5
6
7
8
# File 'lib/tor-privoxy/switcher.rb', line 5

def initialize host, pass, control
  @host, @pass, @control = host, pass, control
  @current = 0
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



3
4
5
# File 'lib/tor-privoxy/switcher.rb', line 3

def host
  @host
end

#passObject (readonly)

Returns the value of attribute pass.



3
4
5
# File 'lib/tor-privoxy/switcher.rb', line 3

def pass
  @pass
end

Instance Method Details

#control_portObject



19
20
21
# File 'lib/tor-privoxy/switcher.rb', line 19

def control_port
  @control[port]
end

#nextObject



10
11
12
13
# File 'lib/tor-privoxy/switcher.rb', line 10

def next
  @current = @current + 1
  @current = 0 if @current >= @control.size
end

#portObject



15
16
17
# File 'lib/tor-privoxy/switcher.rb', line 15

def port
  @control.keys[@current]
end