Last active
          September 28, 2015 07:41 
        
      - 
      
- 
        Save hirakujira/1cbb97a444e73d850916 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | require 'yaml' | |
| lines = File.read(ARGV[0]).split("\n") | |
| header = lines[0].split("\t") | |
| lines.delete(lines[0]) | |
| hashes = [] | |
| lines.each do |line| | |
| values = line.split("\t") | |
| hash = Hash.new {} | |
| header.each_index do |index| | |
| hash[header[index]] = values[index] | |
| end | |
| hashes << hash | |
| end | |
| hashes = hashes.to_yaml | |
| File.write(ARGV[1], hashes, mode: 'w') | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment