Let's say I am using code like this to make inline edits of CSV file:
CSV.open(fn, 'r+') do |f|
old_pos = f.pos
while r = f.shift
if r[0] == 'NOT_PROCESSED'
f.seek(old_pos)
r[0] = 'PASSED ' # pay attention to the padding spaces!
f << r
end
old_pos = f.pos
end
end
Is there a way to somehow use headers with this approach? Like for example r['STATUS']? How should I rewrite code to make this possible?