るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

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

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

...返します。

selector で行列のどの部分を探すかを指定します。この引数の意味は
Matrix#each を参照してください。

//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 (21231.0)

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

...返します。

selector で行列のどの部分を探すかを指定します。この引数の意味は
Matrix#each を参照してください。

//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 (21231.0)

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

...返します。

selector で行列のどの部分を探すかを指定します。この引数の意味は
Matrix#each を参照してください。

//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 探索範囲...

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

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

...aram 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...

CSV::FieldInfo#index -> Integer (18220.0)

行内で何番目のフィールドかわかるゼロベースのインデックスを返します。

...emlist[例][ruby]{
require
'csv'

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field_info.index
Date.parse(field)
end
p csv.first

# => 0
# => 1
# => #<CSV::Row "date1":#<Date: 2018-07-09 ((2458309j,0s,0n),+0s,2299161j)> "date2":#<Date: 2...

絞り込み条件を変える

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

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

...クを省略した場合は、
要素とそのインデックスを繰り返すような
Enumerator を返します。

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

//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 (12343.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 (12343.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 (12252.0)

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

...クを省略した場合は、
要素とそのインデックスを繰り返すような
Enumerator を返します。

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

//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...
<< 1 2 3 ... > >>