class Pacproxy::Runtime

Pacproxy::Runtime represet runtime

Public Class Methods

new() click to toggle source
# File lib/pacproxy/runtime.rb, line 10
def initialize
  @runtime = autodetect
end

Public Instance Methods

find(url) click to toggle source
# File lib/pacproxy/runtime.rb, line 18
def find(url)
  @runtime.find(url)
end
shutdown() click to toggle source
# File lib/pacproxy/runtime.rb, line 14
def shutdown
  @runtime.shutdown
end
update(file_location) click to toggle source
# File lib/pacproxy/runtime.rb, line 22
def update(file_location)
  @runtime.update(file_location)
end

Private Instance Methods

autodetect() click to toggle source
# File lib/pacproxy/runtime.rb, line 28
def autodetect
  name = ENV['PACPROXY_RUNTIME']
  return Runtimes::Node.runtime if name || /Node/ =~ name

  ENV['JS_RUNTIME'] = name
  return Runtimes::Pac.runtime  if Runtimes::Pac.runtime
  return Runtimes::Node.runtime if Runtimes::Node.runtime

  fail(RuntimeUnavailable,
       'No runtime supporting proxy.pac')
end