るりまサーチ

最速Rubyリファレンスマニュアル検索!
734件ヒット [1-100件を表示] (0.097秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

CSV::Row#index(header, minimum_index = 0) -> Integer (18251.0)

与えられたヘッダの名前に対応するインデックスを返します。

...を返します。

@
param header ヘッダの名前を指定します。

@
param minimum_index このインデックスより後で、ヘッダの名前を探します。
重複しているヘッダがある場合に便利です。

//emlist[例][ruby]{
require
"csv"

row = CSV...
...::Row.new(["header1", "header2", "header1"], [1, 2, 3])
row.index("header1") # => 0
row.index("header1", 1) # => 2
//}

@
see CSV::Row#field...

Matrix#index(selector = :all) -> Enumerator (18143.0)

指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。

...//emlist[例][ruby]{
require
'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}

value を指定せず、さらにブロックを省略した場合、
Enumerator を返します。

@
param value 探索する値
@
param selector...

Matrix#index(selector = :all) {|e| ... } -> [Integer, Integer] | nil (18143.0)

指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。

...//emlist[例][ruby]{
require
'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}

value を指定せず、さらにブロックを省略した場合、
Enumerator を返します。

@
param value 探索する値
@
param selector...

Matrix#index(value, selector = :all) -> [Integer, Integer] | nil (18143.0)

指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。

...//emlist[例][ruby]{
require
'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}

value を指定せず、さらにブロックを省略した場合、
Enumerator を返します。

@
param value 探索する値
@
param selector...

Enumerable#each_with_index(*args) {|item, index| ... } -> self (6264.0)

要素とそのインデックスをブロックに渡して繰り返します。

...umerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@
param args イテレータメソッド (each など) にそのまま渡されます。

//emlist[例][ruby]{
[5, 10, 15]...
...each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
require
'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}

@
see Enumerator#with_index...

絞り込み条件を変える

Prime::PseudoPrimeGenerator#each_with_index {|prime, index| ... } -> self (6255.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...ます。

@
return ブロックを与えられた場合は self を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
require
'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2,...
...0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@
see Enumerator#with_index...

Prime::PseudoPrimeGenerator#with_index {|prime, index| ... } -> self (6255.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...ます。

@
return ブロックを与えられた場合は self を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
require
'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2,...
...0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@
see Enumerator#with_index...

Enumerable#each_with_index(*args) -> Enumerator (6164.0)

要素とそのインデックスをブロックに渡して繰り返します。

...umerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@
param args イテレータメソッド (each など) にそのまま渡されます。

//emlist[例][ruby]{
[5, 10, 15]...
...each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
require
'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}

@
see Enumerator#with_index...

Prime::PseudoPrimeGenerator#each_with_index -> Enumerator (6155.0)

与えられたブロックに対して、素数を0起点の連番を渡して評価します。

...ます。

@
return ブロックを与えられた場合は self を返します。 ブロックを与えられなかった場合は Enumerator を返します。

//emlist[例][ruby]{
require
'prime'
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
p [prime, index]
end
# [2,...
...0]
# [3, 1]
# [5, 2]
# [7, 3]
//}

@
see Enumerator#with_index...
<< 1 2 3 ... > >>