このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

Ruby 2.2.0 リファレンスマニュアル

instance method Range#hash

hash -> Integer[permalink][rdoc]

始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。

例:

p (1..2).hash    # => 5646
p (1...2).hash   # => 16782863