るりまサーチ

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils rm_r
  5. bigdecimal to_r

ライブラリ

クラス

検索結果

CSV::Table#push(*rows) -> self (18232.0)

複数の行を追加するためのショートカットです。

...t[][ruby]{
r
ows.each {|row| self << row }
//}

@param rows CSV::Row のインスタンスか配列を指定します。

//emlist[例][ruby]{
r
equire 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
r
ows = [
CSV::Row.new(table.headers, [4, 5, 6]),
[7, 8, 9]
]

table.push(*rows...
...)
p table[0..2]
# => [#<CSV::Row "a":"1" "b":"2" "c":"3">, #<CSV::Row "a":4 "b":5 "c":6>, #<CSV::Row "a":7 "b":8 "c":9>]
//}

@see CSV::Table#<<...