Class: Tor::Proxy
- Inherits:
-
Object
- Object
- Tor::Proxy
- Defined in:
- lib/tor_proxy.rb,
lib/tor_proxy/version.rb
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
Instance Method Summary collapse
- #get(url) ⇒ Object
-
#initialize(host = 'localhost', port = 9050) ⇒ Proxy
constructor
A new instance of Proxy.
Constructor Details
#initialize(host = 'localhost', port = 9050) ⇒ Proxy
Returns a new instance of Proxy.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/tor_proxy.rb', line 8 def initialize host = 'localhost', port = 9050 unless Tor.available? raise <<-EOS Tor isn't installed. Install Tor to use this module. See http://torproject.org or `brew install tor`. EOS end @proxy = Net::HTTP.SOCKSProxy host, port end |
Class Method Details
.get(url) ⇒ Object
23 24 25 26 |
# File 'lib/tor_proxy.rb', line 23 def self.get url @@proxy ||= self.new @@proxy.get url end |
Instance Method Details
#get(url) ⇒ Object
19 20 21 |
# File 'lib/tor_proxy.rb', line 19 def get url @proxy.get URI.parse(url) end |