Skip to content

Instantly share code, notes, and snippets.

@jorgemanrubia
Created March 22, 2010 19:11
Show Gist options
  • 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