From: Alder Green Date: 2006-01-01T05:47:29+09:00 Subject: Re: Stuck on Page 27 of Programming Ruby ------=_Part_6481_18721780.1136062036846 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello Allen, The problem appears to be with this line: Song.new("Bicylops", "Fleck", 260) The error message says "wrong number of arguments (3 for 0)", meaning that Song#initialize (the initialize method defined by "def initialize .... end" inside the Song class) doesn't take any arguments, while in the above line you are in fact supplying 3 arguments to it. So, either the problem is in the call and you're supposed to call Song.newsans arguments: Song.new() Or Song#initialize got ill-defined/overriden in some problematic way. Option #2 seems more likely; it's not logical that you can create a song object without even a name. Regards, Alder Green On 12/31/05, Allen Dardenelle wrote: > > HI all, this is my first post in the forum! I got the Ruby and Rails > books for Christmas and I am having a lot of fun with them. But I am > stuck on page 27 in Programming Ruby. I've gotten the code from the web > site and it's not working. > > Here is the code: > > !#/usr/local/bin/ruby -w > > class Song > def to_s > "Song: #@name--#@artist (#@duration)" > end > end > song =3D Song.new("Bicylops", "Fleck", 260) > song.to_s > > Here is my error: > > ruby.rb:8:in `initialize': wrong number of arguments (3 for 0) > (ArgumentError) > from ruby.rb:8:in `new' > from ruby.rb:8 > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_6481_18721780.1136062036846--