ExecJS lets you run JavaScript code from Ruby. WWW: https://github.com/sstephenson/execjs