7件ヒット
[1-7件を表示]
(0.012秒)
クラス
- CSV (2)
-
CSV
:: Row (2) -
CSV
:: Table (3)
検索結果
先頭5件
-
CSV
:: Row # to _ hash -> Hash (18610.0) -
自身をシンプルなハッシュに変換します。
...プルなハッシュに変換します。
フィールドの順序は無視されます。
重複したフィールドは削除されます。
//emlist[例][ruby]{
require "csv"
row = CSV::Row.new(["header2", "header1", "header2"], [1, 2, 3])
row.to_hash # => {"header2"=>3, "header1"=>2}
//}... -
CSV
# flush -> self (18310.0) -
IO#flush に委譲します。
IO#flush に委譲します。 -
CSV
:: Row # push(*args) -> self (18310.0) -
複数のフィールドを追加するためのショートカットです。
...複数のフィールドを追加するためのショートカットです。
以下とおなじです:
args.each { |arg| csv_row << arg }
@return メソッドチェーンのために自身を返します。... -
CSV
:: Table # push(*rows) -> self (18310.0) -
複数の行を追加するためのショートカットです。
...//}
@param rows CSV::Row のインスタンスか配列を指定します。
//emlist[例][ruby]{
require '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#<<... -
CSV
# shift -> Array | CSV :: Row (9310.0) -
String や IO をラップしたデータソースから一行だけ読み込んで フィールドの配列か CSV::Row のインスタンスを返します。
...ールドの配列か CSV::Row のインスタンスを返します。
データソースは読み込み用にオープンされている必要があります。
@return ヘッダを使用しない場合は配列を返します。
ヘッダを使用する場合は CSV::Row を返します......。
//emlist[例][ruby]{
require "csv"
csv = CSV.new(DATA.read)
csv.readline # => ["header1", "header2"]
csv.readline # => ["row1_1", "row1_2"]
__END__
header1,header2
row1_1,row1_2
//}... -
CSV
:: Table # to _ csv(options = Hash . new) -> String (310.0) -
CSV の文字列に変換して返します。
...
CSV の文字列に変換して返します。
ヘッダを一行目に出力します。その後に残りのデータを出力します。
デフォルトでは、ヘッダを出力します。オプションに :write_headers =>
false を指定するとヘッダを出力しません。
//emli......st[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_headers: false) # => "1,2,3\n"
//}... -
CSV
:: Table # to _ s(options = Hash . new) -> String (310.0) -
CSV の文字列に変換して返します。
...
CSV の文字列に変換して返します。
ヘッダを一行目に出力します。その後に残りのデータを出力します。
デフォルトでは、ヘッダを出力します。オプションに :write_headers =>
false を指定するとヘッダを出力しません。
//emli......st[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_headers: false) # => "1,2,3\n"
//}...