るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.020秒)

別のキーワード

  1. _builtin hash
  2. hash []
  3. dbm to_hash
  4. matrix hash
  5. _builtin to_hash

クラス

キーワード

検索結果

CSV::Row#to_hash -> Hash (18634.0)

自身をシンプルなハッシュに変換します。

...プルなハッシュに変換します。

フィールドの順序は無視されます。
重複したフィールドは削除されます。

//emlist[例][ruby]{
require "csv"

row = CSV::Row.new(["header2", "header1", "header2"], [1, 2, 3])
row.to_hash # => {"header2"=>3, "header1"=>2}
//}...

CSV::Table#to_csv(options = Hash.new) -> String (316.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 (316.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::Row#<<(arg) -> self (28.0)

自身に与えられたデータを追加します。

...の配列を指定][ruby]{
require "csv"

row = CSV::Row.new([], [], true)

row << ["header1", "row1_1"]
row << ["header2", "row1_2"]
row.to_a # => [["header1", "row1_1"], ["header2", "row1_2"]]
//}

//emlist[例 Hash を指定][ruby]{
require "csv"

row = CSV::Row.new([], [], true)

row << { "heade...