On Tue, 26 Dec 2000, craig duncan wrote:

> John Rubinubi wrote:
> > 
> > Merry Christmas,
> > 
> > I am up to p. 19-20 in Programming Ruby. I am using RubyWin. The code
> > below is uploaded rather than typed online so it is definately what I'm
> > trying to run. As far as I can tell it's exactly like the example in the
> > book except with different data.
> > 
> > Does this seem like it should output something?
> > 
> > class Song
> >   def initialize(name, artist, duration)
> >     @name=name
> >     @artist=artist
> >     @duration=duration
> >   end
> > end
> > asong=Song.new( "Merry Xmas", "Bingo", 180)
> > asong.inspect
> 
> inspect returns the "human readable string" . . . you'll get output if
> you print this out, e.g.
> 
> puts asong.inspect
> 
> or you could just do:
> 
> p asong
> 


Thanks. That did it. Here's another, no doubt equally stupid question.

On p. 16 of Programming Ruby is given

ARGF.each {|line| print line  if line =~/Ruby/ }

which is supposed to print the inputted lines which contain "Ruby"

The while loop example in the book runs as expected but this ARGF
one-liner doesn't seem to do anything.

Thanks,

John