ExecJS lets you run JavaScript code from Ruby. WWW: http://rubygems.org/gems/execjs