class ProxyFetcher::Exceptions::AdapterSetupError

Exception for cases when HTML parser adapter can't be installed. It will print the reason (backtrace) of the exception that caused an error.

Public Class Methods

new(adapter_name, error) click to toggle source

Initialize new exception

@param adapter_name [String] configured adapter name @param error [String] full setup error (backtrace)

@return [AdapterSetupError]

Calls superclass method
# File lib/proxy_fetcher/exceptions.rb, line 113
def initialize(adapter_name, error)
  adapter = demodulize(adapter_name.gsub("Adapter", ""))

  super("can't setup '#{adapter}' adapter during the following error:\n\t#{error}'")
end

Private Instance Methods

demodulize(path) click to toggle source

Returns just class name removing it's namespace.

@param path [String]

full class name

@return [String] demodulized class name

# File lib/proxy_fetcher/exceptions.rb, line 128
def demodulize(path)
  path = path.to_s
  index = path.rindex("::")

  index ? path[(index + 2)..-1] : path
end