1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00
execjs/lib/execjs.rb

27 lines
589 B
Ruby
Raw Normal View History

2011-02-06 15:22:40 -05:00
module ExecJS
2011-02-06 19:59:37 -05:00
class Error < ::StandardError; end
class RuntimeError < Error; end
class ProgramError < Error; end
2011-02-06 21:57:51 -05:00
autoload :ExternalRuntime, "execjs/external_runtime"
2011-02-07 10:01:34 -05:00
autoload :RhinoRuntime, "execjs/rhino_runtime"
2011-02-06 21:57:51 -05:00
autoload :Runtimes, "execjs/runtimes"
autoload :V8Runtime, "execjs/v8_runtime"
2011-02-06 20:09:07 -05:00
def self.exec(source)
runtime.exec(source)
end
def self.eval(source)
runtime.eval(source)
end
def self.runtime
2011-02-06 21:44:01 -05:00
@runtime ||= Runtimes.best_available
2011-02-06 20:09:07 -05:00
end
2011-02-07 13:27:00 -05:00
def self.root
@root ||= File.expand_path("../execjs", __FILE__)
end
2011-02-06 15:22:40 -05:00
end