class Pacproxy::Runtimes::Pac

Pacproxy::Runtimes::Pac represent Pac

Attributes

js_lock[R]
source[R]

Public Class Methods

runtime() click to toggle source
# File lib/pacproxy/runtimes/pac/pac.rb, line 20
def self.runtime
  PAC.runtime
  new
end

Public Instance Methods

find(url) click to toggle source
# File lib/pacproxy/runtimes/pac/pac.rb, line 25
def find(url)
  return 'DIRECT' unless @pac
  Pac.js_lock.synchronize do
    @pac.find(url)
  end
end
update(file_location) click to toggle source
# File lib/pacproxy/runtimes/pac/pac.rb, line 32
def update(file_location)
  Pac.js_lock.synchronize do
    tmp = PAC.load(file_location)
    @pac = tmp if @pac.nil? || @pac.source != tmp.source
  end
rescue => e
  error("#{file_location} update error: #{e}")
end