Skip to content

Instantly share code, notes, and snippets.

@eedrummer
Created October 21, 2010 17:19
Show Gist options
  • Save eedrummer/638892 to your computer and use it in GitHub Desktop.
Save eedrummer/638892 to your computer and use it in GitHub Desktop.
How to run JavaScript in Ruby via the Ruby Racer
# 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