Ruby 2.1.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Integerクラス > <=>
self <=> other -> -1 | 0 | 1 | nil
[permalink][rdoc]self と other を比較して、self が大きい時に1、等しい時に 0、小さい時に-1、比較できない時に nil を返します。
1 <=> 2 # => -1
1 <=> 1 # => 0
2 <=> 1 # => 1
2 <=> '' # => nil