クラス
-
Enumerator
:: ArithmeticSequence (3) - Range (9)
検索結果
先頭5件
-
Range
# exclude _ end? -> bool (18349.0) -
範囲オブジェクトが終端を含まないとき真を返します。
範囲オブジェクトが終端を含まないとき真を返します。
//emlist[例][ruby]{
(1..5).exclude_end? # => false
(1...5).exclude_end? # => true
//} -
Enumerator
:: ArithmeticSequence # exclude _ end? -> bool (18313.0) -
末項(終端)を含まないとき真を返します。
末項(終端)を含まないとき真を返します。 -
Range
# ==(other) -> bool (58.0) -
指定された other が Range クラスのインスタンスであり、 始端と終端が == メソッドで比較して等しく、Range#exclude_end? が同じ場合に true を返します。そうでない場合に false を返します。
指定された other が Range クラスのインスタンスであり、
始端と終端が == メソッドで比較して等しく、Range#exclude_end? が同じ場合に
true を返します。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
p (1..2) == (1..2) # => true
p (1..2) == (1...2) # => false
p (1..2) == Range.new(1.0, 2.0) # => t... -
Range
# eql?(other) -> bool (58.0) -
指定された other が Range クラスのインスタンスであり、 始端と終端が eql? メソッドで比較して等しく、Range#exclude_end? が同じ場合に true を返します。そうでない場合に false を返します。
指定された other が Range クラスのインスタンスであり、
始端と終端が eql? メソッドで比較して等しく、Range#exclude_end? が同じ場合に
true を返します。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
p (1..2).eql?(1..2) # => true
p (1..2).eql?(1...2) # => false
p (1..2).eql?(Range.new(1.0, 2.... -
Range
# hash -> Integer (58.0) -
始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。
始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。
//emlist[例][ruby]{
p (1..2).hash # => 5646
p (1...2).hash # => 16782863
//} -
Enumerator
:: ArithmeticSequence # ==(other) -> bool (28.0) -
Enumerable::ArithmeticSequence として等しいか判定します。
Enumerable::ArithmeticSequence として等しいか判定します。
other が Enumerable::ArithmeticSequence で
begin, end, step, exclude_end? が等しい時に
true を返します。
@param other 自身と比較する Enumerable::ArithmeticSequence -
Enumerator
:: ArithmeticSequence # hash -> Integer (28.0) -
自身のハッシュ値を返します。
自身のハッシュ値を返します。
begin, end, step, exclude_end? が等しい Enumerable::ArithmeticSequence は
同じハッシュ値を返します。 -
Range
# cover?(obj) -> bool (28.0) -
obj が範囲内に含まれている時に true を返します。
obj が範囲内に含まれている時に true を返します。
Range#include? と異なり <=> メソッドによる演算により範囲内かどうかを判定します。
Range#include? は原則として離散値を扱い、
Range#cover? は連続値を扱います。
(数値については、例外として Range#include? も連続的に扱います。)
Range#exclude_end?がfalseなら「begin <= obj <= end」を、
trueなら「begin <= obj < end」を意味します。
@param obj 比較対象のオブジェクトを指定します。
//eml... -
Range
# last(n) -> [object] (28.0) -
最後の n 要素を返します。範囲内に要素が含まれない場合は空の配列を返します。
最後の n 要素を返します。範囲内に要素が含まれない場合は空の配列を返します。
@param n 取得する要素数を整数で指定します。整数以外のオブジェクトを指定
した場合は to_int メソッドによる暗黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
@raise ArgumentError n に負の数を指定した場合に発生します。
[注意] 引数を省略して実行した場合は、終端を含むかどうか
(Range#exclude_end? の戻り... -
Range
# cover?(range) -> bool (13.0) -
2.6 以降の cover? は、Range#include? や Range#=== と異なり、 引数に Range オブジェクトを指定して比較できます。
2.6 以降の cover? は、Range#include? や Range#=== と異なり、
引数に Range オブジェクトを指定して比較できます。
引数が Range オブジェクトの場合、引数の範囲が self の範囲に含まれる時に true を返します。
@param range 比較対象の Range クラスのインスタンスを指定します。
//emlist[引数が Range の例][ruby]{
(1..5).cover?(2..3) #=> true
(1..5).cover?(0..6) #=> false
(1..5).cover?(1...6) ... -
Range
# end -> object (13.0) -
終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。
終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。
//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}
@see Range#begin -
Range
# last -> object (13.0) -
終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。
終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。
//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}
@see Range#begin