class Irc::Utils::AgentFactory

Public Class Methods

new(bot) click to toggle source
# File lib/rbot/core/utils/agent.rb, line 47
def initialize(bot)
  @bot = bot
end

Public Instance Methods

cleanup() click to toggle source
# File lib/rbot/core/utils/agent.rb, line 51
def cleanup
end
create() click to toggle source

Returns a new, unique instance of Mechanize.

# File lib/rbot/core/utils/agent.rb, line 55
def create
  agent = Mechanize.new
  agent.redirection_limit = @bot.config['agent.max_redir']
  if not @bot.config['agent.ssl_verify']
    agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  end
  if @bot.config['agent.proxy_use']
    agent.set_proxy(
      @bot.config['agent.proxy_host'],
      @bot.config['agent.proxy_port'],
      @bot.config['agent.proxy_username'],
      @bot.config['agent.proxy_password']
    )
  end
  agent
end