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:
parent
80b3aa3641
commit
1fc0670769
2 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Reference in a new issue