Sha256: 5655302d05580e2eef15bd456c5d62226fe7ad433dd00a3240949a324e7a3c61
Contents?: true
Size: 868 Bytes
Versions: 2
Compression:
Stored size: 868 Bytes
Contents
# encoding: utf-8 module ProxyPacRb # Parse Proxy pac to file system class ProxyPacParser private attr_reader :environment, :runtime public def initialize( environment: Environment.new, runtime: Runtimes.autodetect ) @runtime = runtime @environment = environment end def parse(proxy_pac) fail Exceptions::RuntimeUnavailable, "#{runtime.name} is unavailable on this system" unless runtime.available? ProxyPac.new( javascript: compile_javascript(proxy_pac.content), file: proxy_pac ) end private def compile_javascript(content) environment.prepare(content) context = runtime.compile(content) context.include environment Javascript.new(context) rescue StandardError => err raise ParserError, err.message end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
proxy_pac_rb-0.4.2 | lib/proxy_pac_rb/proxy_pac_parser.rb |
proxy_pac_rb-0.4.0 | lib/proxy_pac_rb/proxy_pac_parser.rb |