Guest User

Untitled

a guest
Sep 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. require 'yaml'
  2. structure = []
  3. key = ''
  4. File.open(ARGV[0], 'r').each_line.with_index do |lines, index|
  5. data = lines.chomp.split("\t")
  6. key << data if index.zero?
  7. structure << Hash[key.zip(data)] if index > 0
  8. File.open(ARGV[1], 'w') do |file|
  9. file.puts structure.to_yaml if ARGV[1]
  10. print structure.to_yaml
  11. end
  12. end
Add Comment
Please, Sign In to add comment