Possible Duplicate:
What is the Ruby <=> (spaceship) operator?
I saw a code and an operator I’m unfamiliar with
@array << {:suffix=> substring, :index => i}
@array.sort! { |x,y| x[:suffix] <=> y[:suffix]}
I can’t do google on it. What does <=> do?
It does comparison defined for the particular class. If it is the case that
... < ...is true, it returns-1, if... == ...is true, then0, and if... > ...is true, then1.