Class: ProxyPacRb::ProxyPacParser
- Inherits:
-
Object
- Object
- ProxyPacRb::ProxyPacParser
- Defined in:
- lib/proxy_pac_rb/proxy_pac_parser.rb
Overview
Parse Proxy pac to file system
Instance Method Summary collapse
-
#initialize(environment: Environment.new, compiler: JavascriptCompiler.new) ⇒ ProxyPacParser
constructor
A new instance of ProxyPacParser.
- #parse(proxy_pac) ⇒ Object
Constructor Details
#initialize(environment: Environment.new, compiler: JavascriptCompiler.new) ⇒ ProxyPacParser
Returns a new instance of ProxyPacParser.
12 13 14 15 16 17 18 |
# File 'lib/proxy_pac_rb/proxy_pac_parser.rb', line 12 def initialize( environment: Environment.new, compiler: JavascriptCompiler.new ) @environment = environment @compiler = compiler end |
Instance Method Details
#parse(proxy_pac) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/proxy_pac_rb/proxy_pac_parser.rb', line 20 def parse(proxy_pac) return unless proxy_pac.valid? proxy_pac.javascript = compiler.compile(content: proxy_pac.content, environment: environment) proxy_pac.parsable = true rescue => err proxy_pac.parsable = false proxy_pac. = err. end |