From: Dave Lilley Date: 2007-06-24T18:22:23+09:00 Subject: Re: from the ruby book install on win32 Lyle Johnson wrote: > On Jun 22, 2007, at 11:38 PM, Dave Lilley wrote: > >> 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). > You are correct. Also i know that this was the first edition so i thought maybe there was some differences between the version of ruby it was realsed for and this current release. > 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 Never thought of this as a problem! as always it's the simple things you over look that cause the problems. > > 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: > > # > > Hope this helps, > > Lyle visited the ruby online tutorial last night and found it great!! but i am wondering why when i tried doing something from either the pickaxe book or a online pdf the interactive shell wouldn't allow me to do the same things! one was to create a def (still i'll check this out better another night). thanks for the help so far and in the famous words of arnie I'll be back! dave. -- Posted via http://www.ruby-forum.com/.