ExecJS lets you run JavaScript code from Ruby.

WWW: https://github.com/rails/execjs