Hi, total noob here. I'm only on page 25 of the Pick Axe book and I'm a
I'm running Ruby version 1.8.4 on Windows XP Home Edition. I'm entering
code via irb.
Here's the problem: I enter the following code from the book:
def initialize(name, artist, duration)
@name = name
@artist = artist
@duration = duration
"Song: #@name--#@artist (#@duration)"
I successfully load the code using a file called song.rb here:
irb(main):008:0> load "c:/code/song.rb"
Now the book states that if I type in this:
song = Song.new("Bicylops", "Fleck", 260)
I should see this:
But I'm not, I'm getting this:
irb(main):013:0> song = Song.new("Bicylops", "Fleck", 260)
=> #<Song:0x2c80440 @duration=260, @name="Bicylops", @artist="Fleck">
Obviously I'm still seeing the object ID when I should be seeing the
string. Any help will be appreciated.
Posted via http://www.ruby-forum.com/.