Running Ruby in the Browser

This is an experiement to run Ruby in the browser. It uses an embedded JRuby applet, and the page communicates to that puppy via LiveConnect. This simple example shows running code via script type="text/jruby" (which is run automaticlly once, which you see in the output below), and from a form itself. From here we will allow smart bidirectional talk between the DOM and Ruby, and offer up a nice abstraction layer to hopefully enable something like:

<script type="text/ruby">
  document.ready do |dom|
    dom["table tr"] <<"<td>test</td>"

Ruby Output

Results from either your own ruby, or the embedded ruby, will appear here:


Running embedded script

If you do a view source, you will see JRuby code wrapped in a <script type="text/jruby"> tag. You can see that code by clicking the show embedded ruby button, or you can run it via the Run button (output below)

Running your ruby

Interactively throw some ruby in, and stuff from the last line will come back at you in the output. Right now the input/output streams are not setup correctly, so do not put in any output code (such as puts) as it won't work.