るりまサーチ

最速Rubyリファレンスマニュアル検索!
371件ヒット [301-371件を表示] (0.152秒)
トップページ > クエリ:t[x] > クエリ:ruby[x] > クラス:Range[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. matrix t
  4. t61string new
  5. fiddle type_size_t

ライブラリ

キーワード

検索結果

<< < ... 2 3 4 >>

Range#end -> object (109.0)

終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。

...終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。

//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}

@see Range#begin...

Range#%(s) -> Enumerator (108.0)

範囲内の要素を s おきに繰り返します。

...ます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返し...
...ます。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {|v| p v}
# => 10
# 7
# 4
# 1
//}...

Range#%(s) -> Enumerator::ArithmeticSequence (108.0)

範囲内の要素を s おきに繰り返します。

...ます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返し...
...ます。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {|v| p v}
# => 10
# 7
# 4
# 1
//}...

Range#==(other) -> bool (108.0)

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

...指定された other が Range クラスのインスタンスであり、
始端と終端が == メソッドで比較して等しく、Range#exclude_end? が同じ場合に
t
rue を返します。そうでない場合に 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) # => true
//}...

Range#eql?(other) -> bool (108.0)

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

...指定された other が Range クラスのインスタンスであり、
始端と終端が eql? メソッドで比較して等しく、Range#exclude_end? が同じ場合に
t
rue を返します。そうでない場合に 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.0)) # => false
//}...

絞り込み条件を変える

Range#hash -> Integer (108.0)

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

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

//emlist[例][ruby]{
p (1..2).hash # => 5646
p (1...2).hash # => 16782863
//}...

Range#size -> Integer | Float::INFINITY | nil (108.0)

...を返します。始端、終端のいずれかのオブジェクトが
Numeric のサブクラスのオブジェクトではない場合には nil を返します。

//emlist[例][ruby]{
(10..20).size # => 11
("a".."z").size # => nil
(-Float::INFINITY..Float::INFINITY).size # => Infinity
//}...
<< < ... 2 3 4 >>