Class: URI::Generic

Inherits:
Object
  • Object
show all
Defined in:
lib/aspera/proxy_auto_config.rb

Class Method Summary collapse

Class Method Details

.register_proxy_finder {|url| ... } ⇒ Object

Register a custom proxy finder block

Yield Parameters:

  • url (String)

    The URL to find proxy for

Yield Returns:

  • (String, nil)

    Proxy URL or nil to fallback to original method



16
17
18
19
20
# File 'lib/aspera/proxy_auto_config.rb', line 16

def register_proxy_finder
  Aspera.assert(block_given?)
  # overload the method in URI : call user's provided block and fallback to original method
  define_method(:find_proxy){ |env_vars = ENV| yield(to_s) || find_proxy_orig(env_vars)}
end