るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

CSV::Row#each {|header, field| ... } -> self (21245.0)

与えられたブロックにヘッダとフィールドの組を渡して評価します。

...フィールドの組を渡して評価します。

@
return メソッドチェーンのために自身を返します。

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

row
= CSV::Row.new(["header1", "header2", "header3", "header4"], [1, 2, 3, 4])
row
.each { |header, field| puts "#{header} - #{field}" }

# =>...

Matrix#each_with_index(which = :all) {|e, row, col| ... } -> self (6359.0)

行列の各要素をその位置とともに引数としてブロックを呼び出します。

...ができます。
Matrix#each と同じなのでそちらを参照してください。

ブロックを省略した場合、 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 どの要素に対してブロックを呼び出すのかを Symbol で指定します
@
see Matrix#each...

Matrix#each_with_index(which = :all) -> Enumerator (6159.0)

行列の各要素をその位置とともに引数としてブロックを呼び出します。

...ができます。
Matrix#each と同じなのでそちらを参照してください。

ブロックを省略した場合、 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 どの要素に対してブロックを呼び出すのかを Symbol で指定します
@
see Matrix#each...

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

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

...[][ruby]{
row
s.each {|row| self << row }
//}

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

//emlist[例][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
row
s = [
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#<<...