Class: TorPrivoxy::Switcher
- Inherits:
-
Object
- Object
- TorPrivoxy::Switcher
- Defined in:
- lib/tor-privoxy/switcher.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#pass ⇒ Object
readonly
Returns the value of attribute pass.
Instance Method Summary collapse
- #control_port ⇒ Object
-
#initialize(host, pass, control) ⇒ Switcher
constructor
A new instance of Switcher.
- #next ⇒ Object
- #port ⇒ Object
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
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/tor-privoxy/switcher.rb', line 3 def host @host end |
#pass ⇒ Object (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_port ⇒ Object
19 20 21 |
# File 'lib/tor-privoxy/switcher.rb', line 19 def control_port @control[port] end |
#next ⇒ Object
10 11 12 13 |
# File 'lib/tor-privoxy/switcher.rb', line 10 def next @current = @current + 1 @current = 0 if @current >= @control.size end |
#port ⇒ Object
15 16 17 |
# File 'lib/tor-privoxy/switcher.rb', line 15 def port @control.keys[@current] end |