A brief foray into Ruby

Created: 21 December 2005  Modified:

Originally published on chrislynch.info website.

Well I put in a few hours this week working with the Ruby programming language. It has alot going it, but still is somewhat immature. As my first foray I decided to convert a Perl script that I had already written. Things went along pretty smoothly at first. Ruby has a pretty clean syntax which looks like something of a cross between Perl and Visual Basic. It comes with some new ways at looking at looping that can be a timesaver as well with its anonymous blocks. The only thing I really didn’t like about the language was that it didn’t have unary increment and decrement operators. Which wouldn’t be so bad but they didn’t build in increment/decrement methods into the number classes.

One problem I couldn’t overcome was what looks to be a bug in the WIN32OLE package. I kept getting a WIN32OLERuntimeException whenever I tried to access the document object of Internet Explorer. A code sample is below. So that pretty much decided me not to put too much effort into Ruby. It looks to have some exciting features but it still has bugs which reflects on its relative immaturity compared to Perl.

require 'win32ole'


class Browser
  def initialize
    @ie = WIN32OLE.new("InternetExplorer.Application")
    @ie.visible = 1
    @ie.navigate("http://www.yahoo.com/")
    print @ie.Document.title
  end
end

mybrowser = Browser.new
tags: blog - old blog - News
   Memory is Fleeting