Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
Add disabled runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jan 19, 2012
1 parent 7fc7967 commit 940065e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/execjs/disabled_runtime.rb
@@ -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
3 changes: 3 additions & 0 deletions lib/execjs/runtimes.rb
@@ -1,4 +1,5 @@
require "execjs/module"
require "execjs/disabled_runtime"
require "execjs/external_runtime"
require "execjs/johnson_runtime"
require "execjs/mustang_runtime"
Expand All @@ -7,6 +8,8 @@

module ExecJS
module Runtimes
Disabled = DisabledRuntime.new

RubyRacer = RubyRacerRuntime.new

RubyRhino = RubyRhinoRuntime.new
Expand Down

0 comments on commit 940065e

Please sign in to comment.