mirror of
https://github.com/rails/execjs
synced 2023-03-27 23:21:20 -04:00
Add disabled runtime
This commit is contained in:
parent
7fc79675cd
commit
940065e8f5
2 changed files with 26 additions and 0 deletions
23
lib/execjs/disabled_runtime.rb
Normal file
23
lib/execjs/disabled_runtime.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
module ExecJS
|
||||
class DisabledRuntime
|
||||
def name
|
||||
"Disabled"
|
||||
end
|
||||
|
||||
def exec(source)
|
||||
raise Error, "ExecJS disabled"
|
||||
end
|
||||
|
||||
def eval(source)
|
||||
raise Error, "ExecJS disabled"
|
||||
end
|
||||
|
||||
def compile(source)
|
||||
raise Error, "ExecJS disabled"
|
||||
end
|
||||
|
||||
def available?
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +1,5 @@
|
|||
require "execjs/module"
|
||||
require "execjs/disabled_runtime"
|
||||
require "execjs/external_runtime"
|
||||
require "execjs/johnson_runtime"
|
||||
require "execjs/mustang_runtime"
|
||||
|
@ -7,6 +8,8 @@ require "execjs/ruby_rhino_runtime"
|
|||
|
||||
module ExecJS
|
||||
module Runtimes
|
||||
Disabled = DisabledRuntime.new
|
||||
|
||||
RubyRacer = RubyRacerRuntime.new
|
||||
|
||||
RubyRhino = RubyRhinoRuntime.new
|
||||
|
|
Loading…
Reference in a new issue