Sha256: 9355dbe1a8871deffe6d8ef591e9bb9e2b0616c26712f3b93e7e10146743ea24
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
module PAC module Runtimes require "pac/runtimes/rubyracer" require "pac/runtimes/rubyrhino" require "pac/runtimes/johnson" require "pac/runtimes/mustang" RubyRacer = RubyRacerRuntime.new RubyRhino = RubyRhinoRuntime.new Johnson = JohnsonRuntime.new Mustang = MustangRuntime.new class << self def autodetect from_environment || best_available || raise(RuntimeUnavailable, "Could not find a JavaScript runtime. See https://github.com/samuelkadolph/ruby-pac for a list of runtimes.") end def from_environment if name = ENV["JS_RUNTIME"] if runtime = const_get(name) if runtime.available? runtime if runtime.available? else raise RuntimeUnavailable, "#{runtime.name} runtime is not available on this system" end elsif !name.empty? raise RuntimeUnavailable, "#{name} runtime is not defined" end end end def best_available runtimes.find(&:available?) end def runtimes @runtimes ||= [RubyRacer, RubyRhino, Johnson, Mustang] end end end def self.runtimes Runtimes.runtimes end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pac-1.0.0 | lib/pac/runtimes.rb |