ExecJS lets you run JavaScript code from Ruby.