Executing javascript from Ruby

B

bcparanj

I need to execute a javascript from Ruby. The result of the javascript
is a URL. I could not find anything that help bridge the gap between
javascript and Ruby. Does anyone know if there is something that I can
use for this problem? TIA.
 
A

Axel Etzold

-------- Original-Nachricht --------
Datum: Sat, 24 May 2008 07:45:00 +0900
Von: "(e-mail address removed)" <[email protected]>
An: (e-mail address removed)
Betreff: Executing javascript from Ruby
I need to execute a javascript from Ruby. The result of the javascript
is a URL. I could not find anything that help bridge the gap between
javascript and Ruby. Does anyone know if there is something that I can
use for this problem? TIA.

Hi ---

do you want to open the URL in Ruby ?
There are many possibilities: look eg. here:

http://www.juretta.com/log/2006/08/13/ruby_net_http_and_open-uri/

Best regards,

Axel
 
A

Aaron Patterson

I need to execute a javascript from Ruby. The result of the javascript
is a URL. I could not find anything that help bridge the gap between
javascript and Ruby. Does anyone know if there is something that I can
use for this problem? TIA.

Yes.... Johnson bridges Ruby to JavaScript. We haven't released a gem
yet, but you can check it out from github now. Its pretty stable, and
we only have 1 bug blocking our release. :)

http://github.com/jbarnette/johnson/tree/master

Example:

context = Johnson::Context.new
context.evaluate("function foo() { return 'hello world'; }")
context.evaluate("foo()") # => 'hello world'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,667
Latest member
DaniloB294

Latest Threads

Top