60件ヒット
[1-60件を表示]
(0.021秒)
別のキーワード
種類
- インスタンスメソッド (24)
- クラス (12)
- 特異メソッド (12)
- 定数 (12)
ライブラリ
- csv (60)
クラス
- CSV (48)
キーワード
- CSV (12)
-
DEFAULT
_ OPTIONS (12) - inspect (12)
- new (12)
検索結果
先頭5件
-
CSV
# quote _ char -> String (18119.0) -
フィールドをクオートするのに使用する文字列を返します。
...フィールドをクオートするのに使用する文字列を返します。
//emlist[例][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,row1_2", quote_char: "'")
csv.quote_char # => "'"
//}
@see CSV.new... -
CSV (66.0)
-
このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。
...ずつ
CSV.foreach("sample.csv") do |row|
p row
end
# => ["Ruby", "1995"]
# ["Rust", "2010"]
# ファイルから一度に
p CSV.read("sample.csv")
# => [["Ruby", "1995"], ["Rust", "2010"]]
# 文字列から一行ずつ
CSV.parse(csv_text) do |row|
p row
end
# => ["Ruby", "1995"]
# ["Rus......SV.open("path/to/file.csv", "wb") do |csv|
csv << ["row", "of", "CSV", "data"]
csv << ["another", "row"]
# ...
end
# 文字列へ書き込み
csv_string = CSV.generate do |csv|
csv << ["row", "of", "CSV", "data"]
csv << ["another", "row"]
# ...
end
//}
=== 一行変換
//emlist[][ruby......Arrays or Rows of Strings in the
Encoding of your data. This is accomplished by transcoding the parser itself
into your Encoding.
Some transcoding must take place, of course, to accomplish this multiencoding
support. For example, <tt>:col_sep</tt>, <tt>:row_sep</tt>, and
<tt>:quote_char</tt> mus... -
CSV
. new(data , options = Hash . new) -> CSV (66.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...の区切り文字列を指定します。この文字列はパースする前にデータの
エンコーディングに変換されます。
: :row_sep
行区切りの文字列を指定します。:auto という特別な値をセットすることができます。
:auto を指定した場......ing 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
フィールドをクオートする文字を指定します。長さ 1 の文字列でなければなりません。
正しいダブルク......ields
真をセットすると CSV::Row#unconverted_fields という変換前のフィー
ルドを返すメソッドを全ての行に追加します。headers オプションによって
追加したヘッダはフィールドではないので
CSV::Row#unconverted_fields は空の配列... -
CSV
# inspect -> String (18.0) -
ASCII 互換文字列で自身の情報を表したものを返します。
...ASCII 互換文字列で自身の情報を表したものを返します。
//emlist[例][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,row1_2")
csv.inspect # => "<#CSV io_type:StringIO encoding:UTF-8 lineno:0 col_sep:\",\" row_sep:\"\\n\" quote_char:\"\\\"\">"
//}... -
CSV
:: DEFAULT _ OPTIONS -> Hash (12.0) -
このオプションは呼び出し側で上書きしなかったときに使用するオプションです。
...このオプションは呼び出し側で上書きしなかったときに使用するオプションです。
: :col_sep
","
: :row_sep
:auto
: :quote_char
'"'
: :field_size_limit
nil
: :converters
nil
: :unconverted_fields
nil
: :headers
false
: :return_headers
false
: :header_c...