Created
March 22, 2010 19:11
-
-
Save jorgemanrubia/340413 to your computer and use it in GitHub Desktop.
Accesing javascript from ruby using harmony
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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