Chris Hulan
2/12/2007 5:24:00 PM
On Feb 12, 12:09 pm, Bharat Ruparel <brupa...@mercury.com> wrote:
> I am running the following code from Programming Ruby book on page 120:
....
> puts song1 == song1
>
> It is printing true for the puts song1 == song2 statement. How are
> these two song objects equal?
Note you have 'song1 == song1' which is of course true.
Based on the implementation of the spaceship op (<=>) and the
inclusion of Comparable,
song2 has a longer duration so is "greater than" song1
HTH
Chris