the blog
Back to -Blog

Adventures in Ruby and .NET

More fun with the Ruby Connector
by Huw Collingbourne
Sunday 24 June 2007.

The latest ‘toy application’ I’ve been working on this week is a simple interactive Ruby console which I’ve made using the Ruby Connector. Here it is...

Using this console I can ‘talk to’ the Ruby interpreter from inside a .NET application. For example, in the screen above, you can see that I’ve just evaluated a few Ruby expressions. This is a pretty simple program that doesn’t really do a great deal. Unlike the CD Database I mentioned last week, it doesn’t have to worry about how to get a .NET program to work with Ruby data structures or figure out how to transfer mixed object types from Ruby in such a way that the data can be displayed and modified in C#. In fact, it’s the simplicity of the program that’s its main claim to fame. To get my Ruby Console application to work, this is all the Ruby programming I’ve had to do...

Actually, I could have left out one of those lines ($verbosity=VERBOSE) as that just controls the amount of detail on each object that’s sent back by Ruby via the Connector - but, hey, for a Ruby console, the maximum detail is useful so I added that extra line of code anyhow.

The C# side of the equation is a bit more complex (isn’t it always?) but, even so, my program only amounts to about 30 lines of code, which isn’t too bad, I guess. I’d like, ideally, to make it possible to reduce that C# coding even more. As I said last week, that’s one of the main tasks I’m working on at the moment - making the Ruby Connector itself sufficiently ‘self contained’ that it will be easy to get your .NET programs to talk to Ruby (and get sensible answers back!) with the minimum of fuss.

OK, so now I have a CD database and a Ruby console. What other type of project would make a good demo application for the Ruby Connector?

Hmmm.... I think I feel an adventure game coming on! ;-)

Note: This is a preview of one of the features which is currently ’in development’. The Ruby Connector will be released as part of Ruby In Steel Developer 1.2 later in the year (2007).
Bookmark and Share   Keywords:  .NET  development
© SapphireSteel Software 2014