Sha256: 07b7fc64ce0e24a8f525f3c23c21028f52341e4ae4753b0ec7945ce804756d9d
Contents?: true
Size: 1014 Bytes
Versions: 1
Compression:
Stored size: 1014 Bytes
Contents
require "generator" # the 'public' interface require "johnson/error" require "johnson/runtime" require "johnson/ruby_land_proxy" require "johnson/parser" # visitable module and visitors require "johnson/visitable" require "johnson/visitors" # parse tree nodes require "johnson/nodes" # SpiderMonkey, the default JS engine require "johnson/spidermonkey" module Johnson VERSION = "1.2.0" ### # Evaluate the given JavaScript +expression+ in a new runtime, after # setting the given +vars+ into the global object. # # Returns the result of evaluating the given expression. def self.evaluate(expression, vars={}) runtime = Johnson::Runtime.new vars.each { |key, value| runtime[key] = value } runtime.evaluate(expression) end def self.parse(js, *args) Johnson::Parser.parse(js, *args) end ### # Create a new runtime and load all +files+. # # Returns the new Johnson::Runtime. def self.load(*files) rt = Johnson::Runtime.new rt.load(*files) rt end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
johnson-1.2.0 | lib/johnson.rb |