Skip to content

Instantly share code, notes, and snippets.

@jorgemanrubia
Created March 22, 2010 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgemanrubia/340413 to your computer and use it in GitHub Desktop.
Save jorgemanrubia/340413 to your computer and use it in GitHub Desktop.
Accesing javascript from ruby using harmony
require 'rubygems'
require 'harmony'
code = <<-eos
javascript_object = {
nombre: 'Jorge',
say: function(){
return "Hi there!"
}
};
javascript_object;
eos
page = Harmony::Page.new(<<-HTML)
<html>
</html>
HTML
result = page.execute_js(code)
puts result.say()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment