12件ヒット
[1-12件を表示]
(0.064秒)
別のキーワード
検索結果
-
CSV
. new(data , options = Hash . new) -> CSV (19.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...should be opened in binary mode on Windows if this
feature will be used as the line-ending translation can cause
problems with resetting the document position to where it was before the
read ahead. This String will be transcoded into the data's Encoding before parsing.
: :quote_char
フ......無視します。真を指定すると、ヘッダ行を
ヘッダと値が同一の CSV::Row のインスタンスとして返します。
: :write_headers
真を指定して :headers にも値をセットすると、ヘッダを出力します。
: :header_converters
:converters オプシ......込み][ruby]{
require "csv"
users =<<-EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write("test.csv", users)
File.open("test.csv", "r") do |f|
csv = CSV.new(f, headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "...