Sha256: 7dae8cfe0f1945b9eea920beb8abbda58d4d379a84b90b0939d7aff04889b3a5
Contents?: true
Size: 718 Bytes
Versions: 4
Compression:
Stored size: 718 Bytes
Contents
# frozen_string_literal: true module ProxyPacRb # Compile javascript class JavascriptCompiler private attr_reader :runtime public def initialize( runtime: Runtimes.autodetect ) @runtime = runtime end def compile(content:, environment:) raise Exceptions::RuntimeUnavailable, "#{runtime.name} is unavailable on this system" unless runtime.available? proxy_pac_content = content.to_s.dup proxy_pac_content = environment.prepare(proxy_pac_content) context = runtime.compile(proxy_pac_content) context.include environment Javascript.new(context) rescue StandardError => err raise CompilerError, err.message end end end
Version data entries
4 entries across 4 versions & 1 rubygems