Rython is a Python library that lets you easily mix Ruby and Python languages together.
Why would I want to mix Ruby and Python? There are many reasons to run Ruby code within Python:
* you need a Ruby Gem that provides unique functionality which no Python module provides
* you need a simpler syntax for
Quickstart
First, you need to declare a Ruby context that will run the Ruby code. In this example, we will use Watir (http://wtr.rubyforge.org), a high level web application testing Gem that has no equivalent in Python:
import rython
ctx = rython.RubyContext(requires=["rubygems", "watir"])
Next, instantiate a Watir::Browser object and assign it to a Python variable. The object will be an instance of rython.RubyProxy:
my_browser = ctx("Watir::Browser.new")
assert isinstance(my_browser, rython.RubyProxy)
And now we can call any method on the object instance as well. This example grabs a DIV element from the page by CSS ID 'foobar':
div_element = my_browser("div(:id, 'foobar')")
assert isinstance(div_element, rython.RubyProxy)
Product's homepage
Requirements:
· Python