Ruby 2.1.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Objectクラス > <=>

instance method Object#<=>

self <=> other -> 0 | nil[permalink][rdoc]

self === other である場合に 0 を返します。そうでない場合には nil を返します。



a = Object.new
b = Object.new
a <=> a # => 0
a <=> b # => nil

[SEE_ALSO] Object#===