るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.023秒)
トップページ > バージョン:2.6.0[x] > クエリ:nil[x] > クラス:CSV::FieldInfo[x]

別のキーワード

  1. _builtin nil?
  2. object nil?
  3. nilclass nil?
  4. object nil
  5. _builtin nil

ライブラリ

キーワード

検索結果

CSV::FieldInfo#header -> String | nil (307.0)

利用可能な場合はヘッダを表す文字列を返します。

利用可能な場合はヘッダを表す文字列を返します。

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

csv = CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv.convert do |field,field_info|
p field_info.header
Date.parse(field)
end
p csv.first

# => "date1"
# => "date2"
# => #<CSV::Row "date1":#<Date: 2018-07-09 ((2458309j,...

CSV::FieldInfo#line -> Integer (22.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...