Skip to content

Instantly share code, notes, and snippets.

@patcoll
Created August 4, 2010 19:22
Show Gist options
  • Save patcoll/508636 to your computer and use it in GitHub Desktop.
Save patcoll/508636 to your computer and use it in GitHub Desktop.
file_content = File.open(datafile).map do |line|
line = line.split(',').map { |n| n.strip }
line.each_index do |i|
line[i] = { labels[i][0] => line[i] }
end
line = line.inject({}) { |merged,n| merged.update(n) }
line = { line.delete('LOGRECNO') => line }
end
puts file_content.to_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment