るりまサーチ (Ruby 2.4.0)

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

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer chr
  5. integer new

ライブラリ

キーワード

検索結果

CSV::FieldInfo#index -> Integer (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.index
Date.parse(field)
end
p csv.first

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

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