You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require'csv'raw=<<~EOF name,age tom,13 bob,14 alice,15EOFcsv=CSV.new(raw,headers: true)putscsv.count#=> expect 3, and result is 3putscsv.count#=> expect 3, but result is 0csv=CSV.new(raw,headers: true)putscsv.first['name']#=> expect tom, and result is tomputscsv.first['name']#=> expect tom, but result is bobputscsv.first['name']#=> expect tom, but result is alice
In my sense, .count and .first is not destructive, but these method change csv instance data.
What shoud I do to get result I expect.