るりまサーチ

最速Rubyリファレンスマニュアル検索!
287件ヒット [1-100件を表示] (0.096秒)
トップページ > クエリ:i[x] > クエリ:*[x] > クエリ:collect[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. ipaddr to_i

ライブラリ

クラス

モジュール

検索結果

<< 1 2 3 > >>

Matrix#collect(which = :all) -> Enumerator (21208.0)

行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。

...ます。

@param which which に以下の Symbol を指定することで、
引数として使われる要素を限定できます。
デフォルトは、:all (全ての要素)です。
指定できる Symbol の詳細は、 Matrix#each の項目を参...
...照して下さい。

//emlist[例][ruby]{
require 'matrix'

m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
p m.map(:diagonal) { |x| x * 10 } # => Matrix[[10, 2], [3, 40]]
//}

@see Matrix#each, Matrix#map!...

Matrix#collect(which = :all) {|x| ... } -> Matrix (21208.0)

行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。

...ます。

@param which which に以下の Symbol を指定することで、
引数として使われる要素を限定できます。
デフォルトは、:all (全ての要素)です。
指定できる Symbol の詳細は、 Matrix#each の項目を参...
...照して下さい。

//emlist[例][ruby]{
require 'matrix'

m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
p m.map(:diagonal) { |x| x * 10 } # => Matrix[[10, 2], [3, 40]]
//}

@see Matrix#each, Matrix#map!...

Enumerable#collect {|item| ... } -> [object] (18220.0)

各要素に対してブロックを評価した結果を全て含む配列を返します。

...全て含む配列を返します。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
# すべて 3 倍にした配列を返す
p (1..3).map {|n| n * 3 } # => [3, 6, 9]
p (1..3).collect { "cat" } # => ["cat", "cat", "cat"]
//}

@see Array#collect, Array#map...
...配列を返します。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
# すべて 3 倍にした配列を返す
p (1..3).map {|n| n * 3 } # => [3, 6, 9]
p (1..3).collect { "cat" } # => ["cat", "cat", "cat"]
//}

@see Hash#to_h, Array#collect, Array#map...

Array#collect {|item| ... } -> [object] (18214.0)

各要素に対してブロックを評価した結果を全て含む配列を返します。

...要素に対してブロックを評価した結果を全て含む配列を返します。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
# すべて 3 倍にする
p [1, 2, 3].map {|n| n * 3 } # => [3, 6, 9]
//}

@see Enumerable#collect, Enumerable#map...
...してブロックを評価した結果を全て含む配列を返します。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
# すべて 3 倍にする
p [1, 2, 3].map {|n| n * 3 } # => [3, 6, 9]
//}

@see Hash#to_h, Enumerable#collect, Enumerable#map...

Matrix#collect!(which = :all) -> Enumerator (9208.0)

行列の各要素に対してブロックの適用を繰り返した結果で要素を置き換えます。

...ます。

@param which which に以下の Symbol を指定することで、
引数として使われる要素を限定できます。
デフォルトは、:all (全ての要素)です。
指定できる Symbol の詳細は、 Matrix#each の項目を参...
...照して下さい。


//emlist[例][ruby]{
require 'matrix'

m = Matrix[[1, 2], [3, 4]]

p m.map! { |element| element * 10 } #=> Matrix[[10, 20], [30, 40]]
p m #=> Matrix[[10, 20], [30, 40]]
//}

@see Matrix#each, Matrix#map...

絞り込み条件を変える

Matrix#collect!(which = :all) {|element| ... } -> self (9208.0)

行列の各要素に対してブロックの適用を繰り返した結果で要素を置き換えます。

...ます。

@param which which に以下の Symbol を指定することで、
引数として使われる要素を限定できます。
デフォルトは、:all (全ての要素)です。
指定できる Symbol の詳細は、 Matrix#each の項目を参...
...照して下さい。


//emlist[例][ruby]{
require 'matrix'

m = Matrix[[1, 2], [3, 4]]

p m.map! { |element| element * 10 } #=> Matrix[[10, 20], [30, 40]]
p m #=> Matrix[[10, 20], [30, 40]]
//}

@see Matrix#each, Matrix#map...

Enumerator::Lazy#collect_concat {|item| ... } -> Enumerator::Lazy (6237.0)

ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。

...す。

//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}

ブロックの返した値 x は、以下の場合にのみ分解され、連結されます。

*
x が配列であるか、to_ary メソッドを持つとき
*
x が each...
...それ以外のときは、x は分解されず、そのままの値として使われます。

//emlist[][ruby]{
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force
#=> [{:a=>1}, {:b=>2}]
//}

@raise ArgumentError ブロックを指定しなかった場合に発生します。

@see Enumerable#flat_map...

Array#collect! {|item| ..} -> self (6226.0)

各要素を順番にブロックに渡して評価し、その結果で要素を 置き換えます。

...なかった場合は、自身と map! から生成した
Enumerator オブジェクトを返します。

//emlist[例][ruby]{
ary = [1, 2, 3]
ary.map! {|i| i * 3 }
p ary #=> [3, 6, 9]

ary = [1, 2, 3]
e = ary.map!
e.each{ 1 }
p ary #=> [1, 1, 1]
//}

@see Array#collect, Enumerator...

cgi (6192.0)

CGI プログラムの支援ライブラリです。

...CGI プログラムの支援ライブラリです。

CGI プロトコルの詳細については以下の文書を参照してください。

*
https://tools.ietf.org/html/draft-coar-cgi-v11-03
*
3875: The Common Gateway Interface (CGI) Version 1.1
*
https://www.w3.org/CGI/

=== 使用例

=...
...ist[][ruby]{
require "cgi"
cgi = CGI.new
values = cgi['field_name'] # <== 'field_name' の配列
# 'field_name' が指定されていなかったら、 ""を返す。
fields = cgi.keys # <== field nameの配列

# フォームに 'field_name' というfield nameがあるときに真
cgi...
...ITLE"} } +
cgi.body() do
cgi.form() do
cgi.textarea("get_text") +
cgi.br +
cgi.submit
end +
cgi.pre() do
CGI.escapeHTML(
"params: " + cgi.params.inspect + "\n" +
"cookies: " + cgi.cookies.inspect + "\n" +
ENV.collect...

Array#collect! -> Enumerator (6126.0)

各要素を順番にブロックに渡して評価し、その結果で要素を 置き換えます。

...なかった場合は、自身と map! から生成した
Enumerator オブジェクトを返します。

//emlist[例][ruby]{
ary = [1, 2, 3]
ary.map! {|i| i * 3 }
p ary #=> [3, 6, 9]

ary = [1, 2, 3]
e = ary.map!
e.each{ 1 }
p ary #=> [1, 1, 1]
//}

@see Array#collect, Enumerator...

絞り込み条件を変える

Enumerable#collect_concat -> Enumerator (6120.0)

各要素をブロックに渡し、その返り値を連結した配列を返します。

...ックに渡し、その返り値を連結した配列を返します。

ブロックの返り値は基本的に配列を返すべきです。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
[[1,2], [3,4]].flat_map{|i| i.map{|j| j*2}} # => [2,4,6,8]
//}...
<< 1 2 3 > >>