class ExecJS::Runtime
Abstract base class for runtimes
Public Instance Methods
Source
# File lib/execjs/runtime.rb, line 80 def available? raise NotImplementedError end
Source
# File lib/execjs/runtime.rb, line 68 def compile(source, options = {}) if context_class.instance_method(:initialize).arity == 2 context_class.new(self, source) else context_class.new(self, source, options) end end
Source
# File lib/execjs/runtime.rb, line 44 def context_class self.class::Context end
Source
# File lib/execjs/runtime.rb, line 58 def eval(source, options = {}) context = compile("", options) if context.method(:eval).arity == 1 context.eval(source) else context.eval(source, options) end end
Source
# File lib/execjs/runtime.rb, line 48 def exec(source, options = {}) context = compile("", options) if context.method(:exec).arity == 1 context.exec(source) else context.exec(source, options) end end