[TxMt] Re: problem running ruby code...

plastichairdoo plastichairdoo at gmail.com
Fri Jun 18 03:30:04 UTC 2010


EXACTLY! 
that's it precisely, appreciate the timely response!!
perhaps I missed this in the documentation somewhere? 
I couldn't find anything on the nuts and bolts of the RubyMate interpreter...

anyway thanks alot!
bennett



On Jun 17, 2010, at 7:59 PM, Chris Rebert wrote:

> On Thu, Jun 17, 2010 at 7:49 PM, plastichairdoo
> <plastichairdoo at gmail.com> wrote:
>> 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


>> <snip>


>> 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??
> 
> .inspect just returns a String representing an object in a format
> useful for debugging. To actually *output* the returned string, you
> must pass it to puts(), printf(), or similar.
> 
> The example in the book is probably being input & run into IRB
> (http://en.wikipedia.org/wiki/Interactive_Ruby_Shell ), which by
> default automatically outputs the result of each expression evaluated
> at the top-level; in this case, it automatically outputs the String
> returned by the expression "song.inspect".
> 
> Long story short: The interactive shell works differently than the
> vanilla ruby interpreter. Either add an explicit call to puts/printf,
> or input & run the code in irb from the Terminal instead of using
> TextMate.
> 
> Cheers,
> Chris
> --
> http://blog.rebertia.com
> 
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate




More information about the textmate mailing list