Class: HideMyAss::Proxy::Base
- Inherits:
-
Object
- Object
- HideMyAss::Proxy::Base
- Defined in:
- lib/hidemyass/proxy/base.rb
Overview
Interface for the attributes of each proxy. Such attributes include the ip, port and protocol.
Instance Attribute Summary collapse
-
#row ⇒ Object
readonly
Raw data of the row element.
Instance Method Summary collapse
-
#anonym? ⇒ Boolean
If the proxy’s anonymity is high or even higher.
-
#http? ⇒ Boolean
If the proxy’s network protocol is HTTP.
-
#https? ⇒ Boolean
If the proxy’s network protocol is HTTPS.
-
#initialize(row) ⇒ HideMyAss::Proxy::Base
constructor
Initializes the proxy instance by passing a single row of the fetched result list.
-
#inspect ⇒ String
Custom inspect method.
-
#protocol ⇒ String
The network protocol in in downcase letters.
-
#rel_url ⇒ String
The relative URL without the leading protocol.
-
#secure? ⇒ Boolean
If the proxy’s anonymity is at least high and protocol is encrypted.
-
#socks? ⇒ Boolean
If the proxy’s network protocol is SOCKS.
-
#ssl? ⇒ Boolean
If the proxy supports SSL encryption.
-
#url ⇒ String
The complete URL of that proxy server.
Constructor Details
#initialize(row) ⇒ HideMyAss::Proxy::Base
Initializes the proxy instance by passing a single row of the fetched result list. All attribute readers are lazy implemented.
33 34 35 |
# File 'lib/hidemyass/proxy/base.rb', line 33 def initialize(row) @row = row end |
Instance Attribute Details
#row ⇒ Object (readonly)
Raw data of the row element.
40 41 42 |
# File 'lib/hidemyass/proxy/base.rb', line 40 def row @row end |
Instance Method Details
#anonym? ⇒ Boolean
If the proxy’s anonymity is high or even higher.
95 96 97 |
# File 'lib/hidemyass/proxy/base.rb', line 95 def anonym? anonymity.start_with? 'high' end |
#http? ⇒ Boolean
If the proxy’s network protocol is HTTP.
67 68 69 |
# File 'lib/hidemyass/proxy/base.rb', line 67 def http? protocol == 'http' end |
#https? ⇒ Boolean
If the proxy’s network protocol is HTTPS.
74 75 76 |
# File 'lib/hidemyass/proxy/base.rb', line 74 def https? protocol == 'https' end |
#inspect ⇒ String
114 115 116 |
# File 'lib/hidemyass/proxy/base.rb', line 114 def inspect "<#{self.class.name} #{url}>" end |
#protocol ⇒ String
The network protocol in in downcase letters. (https or http or socks)
46 47 48 |
# File 'lib/hidemyass/proxy/base.rb', line 46 def protocol type end |
#rel_url ⇒ String
The relative URL without the leading protocol.
53 54 55 |
# File 'lib/hidemyass/proxy/base.rb', line 53 def rel_url "#{ip}:#{port}" end |
#secure? ⇒ Boolean
If the proxy’s anonymity is at least high and protocol is encrypted.
102 103 104 |
# File 'lib/hidemyass/proxy/base.rb', line 102 def secure? anonym? && ssl? end |
#socks? ⇒ Boolean
If the proxy’s network protocol is SOCKS.
81 82 83 |
# File 'lib/hidemyass/proxy/base.rb', line 81 def socks? protocol.start_with? 'socks' end |
#ssl? ⇒ Boolean
If the proxy supports SSL encryption.
88 89 90 |
# File 'lib/hidemyass/proxy/base.rb', line 88 def ssl? https? || socks? end |
#url ⇒ String
The complete URL of that proxy server.
60 61 62 |
# File 'lib/hidemyass/proxy/base.rb', line 60 def url "#{protocol}://#{rel_url}" end |