48件ヒット
[1-48件を表示]
(0.039秒)
種類
- インスタンスメソッド (24)
- 定数 (12)
- クラス (12)
ライブラリ
- csv (36)
-
rubygems
/ package / tar _ header (12)
クラス
-
CSV
:: Row (24) -
Gem
:: Package :: TarHeader (12)
検索結果
先頭4件
-
CSV
:: Row # fields(*headers _ and _ or _ indices) -> Array (18303.0) -
与えられた引数に対応する値の配列を返します。
...るこ
とができます。
@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]... -
Gem
:: Package :: TarHeader :: FIELDS -> Array (6302.0) -
内部で使用します。
内部で使用します。 -
CSV
:: Row # values _ at(*headers _ and _ or _ indices) -> Array (3203.0) -
与えられた引数に対応する値の配列を返します。
...るこ
とができます。
@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 (24.0)
-
このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。
...each("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"]
# ["Rust", "2010"]
#......ther", "row"]
# ...
end
//}
=== 一行変換
//emlist[][ruby]{
require 'csv'
csv_string = ["CSV", "data"].to_csv # => "CSV,data"
csv_array = "CSV,String".parse_csv # => ["CSV", "String"]
//}
=== ショートカット
//emlist[][ruby]{
require 'csv'
CSV { |csv_out| csv_out <<......is not ASCII compatible. There's no existing data for CSV to use to
prepare itself and thus you will probably need to manually specify the desired
Encoding for most of those cases. It will try to guess using the fields in a
row of output though, when using CSV::generate_line() or Array#to_csv()....