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

instance method Range#==

self == other -> bool

指定された other が Range クラスのインスタンスであり、 始点と終点が == メソッドで比較して等しく、Range#exclude_end? が同じ場合に true を返します。そうでない場合に false を返します。

[PARAM] other:
自身と比較したいオブジェクトを指定します。
p (1..2) == (1..2)               #=> true
p (1..2) == (1...2)              #=> false
p (1..2) == Range.new(1.0, 2.0)  #=> true
class Range