Ruby Scripts From Java (related to my previous post)

Referring to my (misguided) post regarding making $_ available in JRuby
in a BSF environment…

This is what I need to do - any pointers on best practice appreciated.

So I have a very simple Java (Swing) app which contains two tabs: one
with ‘data’ , one with a Ruby script in it.

I want to call the Ruby script ,using the ‘data’ (a big java string
essentially) on the data to transform it.

I want my ruby scripts to be written to be portable in the sense that I
can re-run them in normal ruby like this:

ruby -an <myscript.rb>

So for instance: myscript.rb:

puts $F[0];

Should process each line in the buffer the same way this would for a

Thanks !