Created
October 21, 2010 17:19
-
-
Save eedrummer/638892 to your computer and use it in GitHub Desktop.
How to run JavaScript in Ruby via the Ruby Racer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install the gem, then | |
require 'v8' | |
cxt = V8::Context.new | |
cxt["effectiveTime"] = Time.gm(2010, 9, 19).to_i | |
cxt.eval("effectiveTime - (365 * 24 * 60 * 60)") #=> 1253318400 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment