On Jun 22, 2007, at 11:38 PM, Dave Lilley wrote:

> Now if i pass parameters to it as in
>
>      ruby Song.rb("here","come frank",60)
>> ruby Song.rb("here","come frank",60)
>      ruby: No such file or directory -- Song.rb(here,come frank,60)
> (LoadError)
>> Exit code: 1
>
> so i expect this is where the error is the parameters aren't know  
> to the
> program
> and i get the LoadError.

Right. When you say "the Ruby book that comes with Ruby 1.8.6 win32",  
I'm going to assume you're talking about "Programming Ruby" (a.k.a.  
the Pickaxe book).

Now that you've created the Song class, you want to test it by  
creating a new Song instance. To do that, add this line to the end of  
your program (Song.rb), after the class definition:

	aSong = Song.new("here", "come frank", 60)

In the Pickaxe book, there's a similar example that uses the song  
"Bicyclops" by Bela Fleck. Now, the discussion in the Pickaxe book  
doesn't make this point very clear, but for you to actually see any  
output from this program, you're going to need to add at least one  
more line:

	puts aSong.inspect

So the entire contents of the file Song.rb should now look something  
like this:

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

	aSong = Song.new("here", "come frank", 60)
	puts aSong.inspect

Now if you run this at the command prompt by typing:

	ruby Song.rb

You should see some output like this:

	#<Song:0x52c970 @duration=60, @name="here", @artist="come frank">

Hope this helps,

Lyle