From: Dick Davies Date: 2006-12-27T22:46:01+09:00 Subject: Re: newbie with a weird technical problem (@ least I think it's weird) On 27/12/06, will wrote: > If I type the _exact_ same thing into > irb I'm able to create a book and book2 instance and .inspect each of > them. But with the TextMate/Terminal combo = Nothing, nadda, zip! > HELP, PLEASE! > > > #filename bib.rb > > class Book > def initialize(title, author, pages) > @title = title > @author = author > @pages = pages > end > end > > book = Book.new("Ruby Tutorial", "Dave", 831) > book.inspect > > > #terminal results > computer: me$ ruby bib.rb > computer: me$ The reason you see output in irb is that irb shows you what the last statement evaluated to, like this: rasputnik@hypnotoad:~$ irb irb(main):001:0> 1 => 1 irb(main):002:0> quit Object#inspect returns a string, but you aren't doing anything with it! irb is showing you the value of book.inspect as usual, but the script version is less verbose. try puts book.inspect and you'll see output from the non-irb version. -- Rasputin :: Jack of All Trades - Master of Nuns http://number9.hellooperator.net/