Permalink
Browse files

Make the readme example work

  • Loading branch information...
sstephenson committed Feb 7, 2011
1 parent 80b3aa3 commit 1fc06707695fb9d010213863cae73fffa472d25a
Showing with 13 additions and 1 deletion.
  1. +12 −0 lib/execjs.rb
  2. +1 −1 readme.md
View
@@ -4,4 +4,16 @@ class RuntimeError < Error; end
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
@@ -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"]

0 comments on commit 1fc0670

Please sign in to comment.