From: "Kroeger Simon (ext)" Date: 2005-08-18T17:47:13+09:00 Subject: Re: is there a shorter way to compare these 2 objects? > From: James Edward Gray II [mailto:james@grayproductions.net] > > def <=>( other ) > [@a, @b, @c, @d] <=> [other.a, other.b, other.c, other.d] > end > > Arrays are Comparable and they compare each of their contents > in order. > > Hope that helps. > > James Edward Gray II not as elegant but without allocating two arrays: def <=>( other ) (@a <=> other.a).nonzero? || (@b <=> other.b).nonzero? || (@c <=> other.c).nonzero? || (@d <=> other.d) end cheers Simon