Class: Proxtopus::Proxy
- Inherits:
-
Object
- Object
- Proxtopus::Proxy
- Defined in:
- lib/proxtopus/proxy.rb
Instance Attribute Summary collapse
-
#anonymity ⇒ Object
Returns the value of attribute anonymity.
-
#country ⇒ Object
Returns the value of attribute country.
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(host, port, protocol, country, anonymity) ⇒ Proxy
constructor
A new instance of Proxy.
Constructor Details
#initialize(host, port, protocol, country, anonymity) ⇒ Proxy
Returns a new instance of Proxy.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/proxtopus/proxy.rb', line 6 def initialize(host, port, protocol, country, anonymity) @host = host.to_s.downcase @port = port.to_i @protocol = protocol.to_s.downcase @country = country.to_s if anonymity =~ /h(igh(ly)?)?\s*a(non(ymous)?)?\s*(p(roxy)?)?/ix @anonymity = 'HAP' elsif anonymity =~ /a(non(ymous)?)?\s*(p(roxy)?)?/ix @anonymity = 'AP' elsif anonymity =~ /t(rans(parent)?)?\s*(p(roxy)?)?/ix @anonymity = 'TP' else puts "Invalid anonymity '#{anonymity}'... ignoring." @anonymity = nil end #puts "[Initialized Proxy]" #puts "#{@procotol}://#{@host}:#{@port} w/ #{@anonymity},#{@country}" #puts #puts end |
Instance Attribute Details
#anonymity ⇒ Object
Returns the value of attribute anonymity.
4 5 6 |
# File 'lib/proxtopus/proxy.rb', line 4 def anonymity @anonymity end |
#country ⇒ Object
Returns the value of attribute country.
4 5 6 |
# File 'lib/proxtopus/proxy.rb', line 4 def country @country end |
#host ⇒ Object
Returns the value of attribute host.
4 5 6 |
# File 'lib/proxtopus/proxy.rb', line 4 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
4 5 6 |
# File 'lib/proxtopus/proxy.rb', line 4 def port @port end |
#protocol ⇒ Object
Returns the value of attribute protocol.
4 5 6 |
# File 'lib/proxtopus/proxy.rb', line 4 def protocol @protocol end |