Module: Proxifier

Defined in:
lib/proxifier.rb,
lib/proxifier/env.rb,
lib/proxifier/proxy.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, SOCKS4AProxy, SOCKS4Proxy, SOCKSProxy

Constant Summary collapse

VERSION =
"1.1.0"
SOCKS5Proxy =
SOCKSProxy

Class Method Summary collapse

Class Method Details

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

Raises:

  • (ArgumentError)


16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/proxifier.rb', line 16

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