7件ヒット
[1-7件を表示]
(0.155秒)
検索結果
先頭5件
-
CSV
:: Table # [](header) -> [String] | [nil] (9361.0) -
ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。
...ッダの名前を指定すれば列単位で動作します。
このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。
@param index ミックスモード・ロ......csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
# ミックスモード
p table.mode # => :col_or_row
p table[0] # => #<CSV::Row "header1":"row1_1" "header2":... -
CSV
:: Table # [](index) -> CSV :: Row | [String] | nil (9361.0) -
ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。
...ッダの名前を指定すれば列単位で動作します。
このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。
@param index ミックスモード・ロ......csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
# ミックスモード
p table.mode # => :col_or_row
p table[0] # => #<CSV::Row "header1":"row1_1" "header2":... -
CSV
:: Table # [](range) -> [CSV :: Row]| [Array] | nil (9361.0) -
ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。
...ッダの名前を指定すれば列単位で動作します。
このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。
@param index ミックスモード・ロ......csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1, row2])
# ミックスモード
p table.mode # => :col_or_row
p table[0] # => #<CSV::Row "header1":"row1_1" "header2":... -
CSV
:: Table # []=(index _ or _ header , value) (9343.0) -
ミックスモードでは、このメソッドは引数に行番号を指定すれば行単位で動作 し、ヘッダの名前を指定すれば列単位で動作します。
...ッダの名前を指定すれば列単位で動作します。
このメソッドを呼び出す前に CSV::Table#by_col! を呼び出すとカラム
モードになります。また CSV::Table#by_row! を呼び出すとロウモード
になります。
行には配列か CSV::Row のインス......_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
row3 = CSV::Row.new(["header1", "header2"], ["row3_1", "row3_2"])
table = CSV::Table.new([row1, row2])
table[0] # => #<CSV::Row "header1":"row1_1" "header2":"row1_2">
table[1] # => #<CSV::Row "header1":"row2_1" "header2":"row2_2... -
CSV
:: Table # <<(row _ or _ array) -> self (9325.0) -
自身の最後に新しい行を追加します。
...mlist[例][ruby]{
require "csv"
row1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table = CSV::Table.new([row1])
table << row2
table.to_a # => [["header1", "header2"], ["row1_1", "row1_2"], ["row2_1", "row2_2"]]
//}... -
CSV
:: Table # ==(other) -> bool (9325.0) -
自身の全ての行が比較対象と同じである場合は真を返します。 そうでない場合は偽を返します。
...自身の全ての行が比較対象と同じである場合は真を返します。
そうでない場合は偽を返します。
@param other CSV::Table を指定します。
//emlist[例][ruby]{
require "csv"
row1_1 = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
row1_2 = CSV::Ro......w(["header1", "header2"], ["row1_1", "row1_2"])
row2_2 = CSV::Row.new(["header1", "header2"], ["row2_1", "row2_2"])
table1 = CSV::Table.new([row1_1, row1_2])
table2 = CSV::Table.new([row2_1, row2_2])
table1 == table2 # => true
table2 << CSV::Row.new(["header1", "header2"], ["row3_1", "row3_2"])
tabl... -
CSV
:: Table # push(*rows) -> self (9325.0) -
複数の行を追加するためのショートカットです。
...ire 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
rows = [
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#<<...