363件ヒット
[1-100件を表示]
(0.124秒)
種類
- インスタンスメソッド (264)
- 特異メソッド (88)
- 定数 (11)
クラス
- CSV (220)
-
CSV
:: FieldInfo (22) -
CSV
:: Row (77) -
CSV
:: Table (44)
キーワード
-
DEFAULT
_ OPTIONS (11) - [] (44)
- []= (22)
- close (11)
-
close
_ read (11) -
close
_ write (11) - delete (11)
- each (11)
-
external
_ encoding (11) - field (11)
-
field
_ size _ limit (11) - fields (11)
- foreach (11)
- fsync (11)
-
generate
_ line (11) - header (11)
- headers (11)
-
internal
_ encoding (11) - line (11)
- new (11)
- open (44)
- parse (11)
- pid (11)
-
unconverted
_ fields? (11) -
values
_ at (11) -
write
_ headers? (11)
検索結果
先頭5件
-
CSV
# internal _ encoding -> Encoding | nil (18503.0) -
IO#internal_encoding に委譲します。
...
IO#internal_encoding に委譲します。
@see IO#internal_encoding... -
CSV
# external _ encoding -> Encoding | nil (12403.0) -
IO#external_encoding に委譲します。
...
IO#external_encoding に委譲します。... -
CSV
. generate _ line(row , options = Hash . new) -> String (12308.0) -
このメソッドは一つの Array オブジェクトを CSV 文字列に変換するためのショートカットです。 複数行のCSVを扱う際はCSV#<<を使うとより高速です。
...ドは一つの Array オブジェクトを CSV 文字列に変換するためのショートカットです。
複数行のCSVを扱う際はCSV#<<を使うとより高速です。
このメソッドは可能であれば row に含まれる最初の nil でない値を用いて出力の
エンコ......ions CSV.new のオプションと同じオプションを指定できます。
:encoding というキーを使用すると出力のエンコーディングを指定することができます。
:row_sep というキーの値には $/ がセットされます。
//eml......ist[例][ruby]{
require "csv"
taro = ['1', 'taro', 'tanaka', '20']
CSV.generate_line(taro, col_sep: '|') # => "1|taro|tanaka|20\n"
//}
@see CSV.new... -
CSV
:: FieldInfo # line -> Integer (12308.0) -
行番号を返します。
...返します。
//emlist[例][ruby]{
require 'csv'
csv = CSV.new("date1,date2,date3\n2018-07-09,2018-07-10\n2018-08-09,2018-08-10", headers: true)
csv.convert do |field,field_info|
p field_info.line
Date.parse(field)
end
p csv.to_a
# => 2
# => 2
# => 3
# => 3
# => [#<CSV::Row "date1":#<Date:......2018-07-09 ((2458309j,0s,0n),+0s,2299161j)> "date2":#<Date: 2018-07-10 ((2458310j,0s,0n),+0s,2299161j)> "date3":nil>, ...]
//}... -
CSV
# close _ write -> nil (12303.0) -
IO#close_write に委譲します。
...
IO#close_write に委譲します。
@see IO#close_write... -
CSV
:: DEFAULT _ OPTIONS -> Hash (12232.0) -
このオプションは呼び出し側で上書きしなかったときに使用するオプションです。
...るオプションです。
: :col_sep
","
: :row_sep
:auto
: :quote_char
'"'
: :field_size_limit
nil
: :converters
nil
: :unconverted_fields
nil
: :headers
false
: :return_headers
false
: :header_converters
nil
: :skip_blanks
false
: :force_quotes
false
: :skip_lines
nil... -
CSV
# field _ size _ limit -> Integer (12208.0) -
フィールドサイズの最大値を返します。
...。
//emlist[例][ruby]{
require "csv"
csv = CSV.new(DATA)
csv.field_size_limit # => nil
p csv.read # => [["a", "b"], ["\n2\n2\n", ""]]
DATA.rewind
csv = CSV.new(DATA, field_size_limit: 4)
p csv.field_size_limit # => 4
csv.read # => #<CSV::MalformedCSVError: Field size exceeded on line 2.>
__END......__
"a","b"
"
2
2
",""
//}
@see CSV.new... -
CSV
# unconverted _ fields? -> bool (12208.0) -
パースした結果が unconverted_fields というメソッドを持つ場合に真を返します。 そうでない場合は、偽を返します。
...た結果が unconverted_fields というメソッドを持つ場合に真を返します。
そうでない場合は、偽を返します。
//emlist[例][ruby]{
require "csv"
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10")
csv.unconverted_fields? # => nil
csv = CSV.new("date1,date2\n2018-07......-09,2018-07-10", unconverted_fields: false)
csv.unconverted_fields? # => false
csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true, unconverted_fields: true)
csv.unconverted_fields? # => true
csv.convert(:date)
row = csv.readline
row.fields # => [#<Date: 2018-07-09 ((24583......09j,0s,0n),+0s,2299161j)>, #<Date: 2018-07-10 ((2458310j,0s,0n),+0s,2299161j)>]
row.unconverted_fields # => ["2018-07-09", "2018-07-10"]
//}
@see CSV.new... -
CSV
:: Row # fields(*headers _ and _ or _ indices) -> Array (12208.0) -
与えられた引数に対応する値の配列を返します。
...与えられた引数に対応する値の配列を返します。
要素の探索に CSV::Row.field を使用しています。
@param headers_and_or_indices ヘッダの名前かインデックスか Range
のインスタンスか第 1 要素がヘッダの名前......るこ
とができます。
@return 引数を与えなかった場合は全ての要素を返します。
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
row = table.first
row.values_at("a", 1, 2..3) # => ["1", "2", "3", nil]... -
CSV
:: Row # values _ at(*headers _ and _ or _ indices) -> Array (9208.0) -
与えられた引数に対応する値の配列を返します。
...与えられた引数に対応する値の配列を返します。
要素の探索に CSV::Row.field を使用しています。
@param headers_and_or_indices ヘッダの名前かインデックスか Range
のインスタンスか第 1 要素がヘッダの名前......るこ
とができます。
@return 引数を与えなかった場合は全ての要素を返します。
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
row = table.first
row.values_at("a", 1, 2..3) # => ["1", "2", "3", nil]...