Skip to content

Instantly share code, notes, and snippets.

@kangkyu
Created October 1, 2015 05:50
Show Gist options
  • Save kangkyu/0a3ed66bda887e307e74 to your computer and use it in GitHub Desktop.
Save kangkyu/0a3ed66bda887e307e74 to your computer and use it in GitHub Desktop.
result_hash = Hash.new([0, ""])
File.read("path/to/file").each_line do |line| # something like that
line.each do |column_name, value| # a line is not an hash or nested array, but could possibly convert somehow
if result_hash[column_name][0] < value.length
result_hash[column_name][0] = value.length
result_hash[column_name][1] = line[factual_id]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment