Troubles Extending IRB

Hi,

I’m having troubles extending IRB and the purpose for me trying to
extend to IRB is so that I can integrate it into a GTK widget.

If anyone has seen the infamous Python console in gedit and Epiphany
(http://raphael.slinckx.net/images/gedit-python.png), this is what I’d
like to do with IRB.

My ultimate goal is to use the Syntax library
(http://syntax.rubyforge.org) to create a custom syntax highlighting
widget using Gtk::TextView and write a full-fledged Ruby programmer’s
editor and create countless plugins, the first one being the IRB GTK
console.

Ever since I’ve seen the Python console I’ve been fascinated by it and
thought Ruby should have something like it.

Unfortunately I am unable to understand 80% of IRB’s code (badly
indented and underdocumented.

I’ve tried understanding out IRB::InputMethod works, and I’ve got that
part down and working in the GTK console, but I can’t seem to have it
work with output that well.

I pass it code, and it doesn’t evaluate until I hand it multi-byte
characters (Korean) and at which point IRB just halts (even from the
terminal, for some odd reason).

I’ve seen that _why has been able to do something of what I want using
his TryRuby program at http://tryruby.hobix.com.

If everything else fails, I plan to use the Syntax library’s excellent
tokenizer to create my own extendable Ruby prompt, but if possible I’d
like to use existing tools and widely known projects, such as IRB.

I hear I can do this in a unnatural way using IO redirection, but I’m
not familiar with the underlying concepts of IO.