276件ヒット
[1-100件を表示]
(0.024秒)
別のキーワード
種類
- インスタンスメソッド (239)
- 文書 (37)
クラス
- Hash (100)
- Matrix (48)
-
Prime
:: PseudoPrimeGenerator (48)
モジュール
- Enumerable (43)
キーワード
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) - each (24)
-
each
_ with _ index (72) - filter! (14)
-
keep
_ if (24) -
ruby 1
. 6 feature (12) - select! (24)
-
to
_ h (19) -
transform
_ keys! (20) -
transform
_ values! (18)
検索結果
先頭5件
- Prime
:: PseudoPrimeGenerator # with _ index {|prime , index| . . . } -> self - Prime
:: PseudoPrimeGenerator # with _ index -> Enumerator - Enumerable
# each _ with _ index(*args) {|item , index| . . . } -> self - Prime
:: PseudoPrimeGenerator # each _ with _ index {|prime , index| . . . } -> self - Matrix
# each _ with _ index(which = :all) {|e , row , col| . . . } -> self
-
Prime
:: PseudoPrimeGenerator # with _ index {|prime , index| . . . } -> self (18224.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]
# [... -
Prime
:: PseudoPrimeGenerator # with _ index -> Enumerator (18124.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]
# [... -
Enumerable
# each _ with _ index(*args) {|item , index| . . . } -> self (6233.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...場合は、
要素とそのインデックスを繰り返すような
Enumerator を返します。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。
@param args イ......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 (6224.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]
# [... -
Matrix
# each _ with _ index(which = :all) {|e , row , col| . . . } -> self (6209.0) -
行列の各要素をその位置とともに引数としてブロックを呼び出します。
...さい。
ブロックを省略した場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each_with_index do |e, row, col|
puts "#{e} at #{row}, #{col}"
end
# => 1 at 0, 0
# => 2 at 0, 1
# => 3 at 1, 0
# => 4 at 1, 1
//}
@param which ど... -
Enumerable
# each _ with _ index(*args) -> Enumerator (6133.0) -
要素とそのインデックスをブロックに渡して繰り返します。
...場合は、
要素とそのインデックスを繰り返すような
Enumerator を返します。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。
@param args イ......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 (6124.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]
# [... -
Matrix
# each _ with _ index(which = :all) -> Enumerator (6109.0) -
行列の各要素をその位置とともに引数としてブロックを呼び出します。
...さい。
ブロックを省略した場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each_with_index do |e, row, col|
puts "#{e} at #{row}, #{col}"
end
# => 1 at 0, 0
# => 2 at 0, 1
# => 3 at 1, 0
# => 4 at 1, 1
//}
@param which ど... -
Hash
# filter! {|key , value| . . . } -> self | nil (137.0) -
キーと値を引数としてブロックを評価した結果が真であるような要素を self に残します。
...数としてブロックを評価した結果が真であるような要素を self
に残します。
keep_if は常に self を返します。
filter! と select! はオブジェクトが変更された場合に self を、
されていない場合に nil を返します。
ブロックが与え......は、自身と keep_if から生成した
Enumerator オブジェクトを返します。
//emlist[例][ruby]{
h1 = {}
c = ("a".."g")
c.each_with_index {|e, i| h1[i] = e }
h2 = h1.dup
h1.select! # => #<Enumerator: {0=>"a", 1=>"b", 2=>"c", 3=>"d", 4=>"e", 5=>"f", 6=>"g"}:select!>
h1.select! { |k...