Class: Pacproxy::Runtimes::Pac
- Includes:
- Loggable
- Defined in:
- lib/pacproxy/runtimes/pac/pac.rb
Overview
Pacproxy::Runtimes::Pac represent Pac
Class Attribute Summary collapse
-
.js_lock ⇒ Object
readonly
Returns the value of attribute js_lock.
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Loggable
#access_logger, #accesslog, #debug, #error, #fatal, #general_logger, #info, #lwarn
Methods inherited from Base
Constructor Details
This class inherits a constructor from Pacproxy::Runtimes::Base
Class Attribute Details
.js_lock ⇒ Object (readonly)
Returns the value of attribute js_lock.
17 18 19 |
# File 'lib/pacproxy/runtimes/pac/pac.rb', line 17 def js_lock @js_lock end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
13 14 15 |
# File 'lib/pacproxy/runtimes/pac/pac.rb', line 13 def source @source end |
Class Method Details
.runtime ⇒ Object
20 21 22 23 |
# File 'lib/pacproxy/runtimes/pac/pac.rb', line 20 def self.runtime PAC.runtime new end |
Instance Method Details
#find(url) ⇒ Object
25 26 27 28 29 30 |
# 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) ⇒ Object
32 33 34 35 36 37 38 39 |
# 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 |