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

Make the readme example work

This commit is contained in:
Sam Stephenson 2011-02-06 19:09:07 -06:00
parent 80b3aa3641
commit 1fc0670769
2 changed files with 13 additions and 1 deletions

View file

@ -4,4 +4,16 @@ module ExecJS
class ProgramError < Error; end
autoload :Runtimes, "execjs/runtimes"
def self.exec(source)
runtime.exec(source)
end
def self.eval(source)
runtime.eval(source)
end
def self.runtime
@runtime ||= Runtimes::Node
end
end

View file

@ -19,5 +19,5 @@ ExecJS supports these runtimes:
A short example:
require "execjs"
ExecJS.eval "'red yellow blue'.split('')"
ExecJS.eval "'red yellow blue'.split(' ')"
# => ["red", "yellow", "blue"]