[TxMt] problem running ruby code...

plastichairdoo plastichairdoo at gmail.com
Fri Jun 18 02:49:38 UTC 2010


hi there - I've been trying my hand at learning Ruby and have been running some small scripts within TM but now I've run into a problem... here's the code I'm trying to run:

------------CODE--------------

class Song
  def initialize(name, artist, duration)
    @name = name
    @artist = artist
    @duration = duration
  end
  
end

song = Song.new("Ruby Tuesday", "Rolling Stones", 360)
song.inspect

------------CODE--------------

however when I use the "Run" command the output window shows up blank - no errors, just blank. 
adding this line to the class:

printf("foo") 

results in "foo" in the output window but nothing else. 

this code is taken directly from the "Programming Ruby" book published by The Pragmatic Programmers and should output some stuff that would take me far too long to type...

so, I'm obviously a bit of a noob - can you tell me what's going on?? is there some kind of limitation to the RubyMate bundle that doesn't allow passing of parameters into instantiated objects??

any kind of help would be great - I LOVE TM and use it for everything else I do so I'd love to use it for this too!

I should add that I'm running the latest version of OS X 10.6 and TM version 1.5.8 and that I have NOT installed Ruby via Terminal or anything else - I assumed that TM's RubyMate is a full fledged runtime environment for code testing... perhaps that I my mistake??
thanks in advance
bennett


More information about the textmate mailing list