Module: Proxifier

Defined in:
lib/proxifier.rb,
lib/proxifier/env.rb,
lib/proxifier/proxy.rb,
lib/proxifier/errors.rb,
lib/proxifier/version.rb,
lib/proxifier/proxies/http.rb,
lib/proxifier/proxies/socks.rb,
lib/proxifier/proxies/socks4.rb,
lib/proxifier/proxies/socks4a.rb

Defined Under Namespace

Modules: EnvironmentProxify, Proxify Classes: HTTPProxy, Proxy, ProxyError, SOCKS4AProxy, SOCKS4Proxy, SOCKSProxy

Constant Summary collapse

VERSION =
"1.0.3"
SOCKS5Proxy =
SOCKSProxy

Class Method Summary collapse

Class Method Details

.Proxy(url, options = {}) ⇒ Object

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/proxifier.rb', line 13

def self.Proxy(url, options = {})
  url = URI.parse(url)

  raise(ArgumentError, "proxy url has no scheme") unless url.scheme
  begin
    klass = const_get("#{url.scheme.upcase}Proxy")
  rescue NameError
    raise(ArgumentError, "unknown proxy scheme `#{url.scheme}'")
  end

  klass.new(url, options)
end