Skip to content

Instantly share code, notes, and snippets.

@gr33n7007h
Created September 30, 2019 14:54
Show Gist options
  • Save gr33n7007h/794b51b16515d8c2e1ec11e93b9c4236 to your computer and use it in GitHub Desktop.
Save gr33n7007h/794b51b16515d8c2e1ec11e93b9c4236 to your computer and use it in GitHub Desktop.
require 'yaml'
t = %i(name address tel fax email website).freeze
c = []
File.read('data.txt').split("\n\n").each do |line|
c << t.zip(line.split("\n")).to_h
end
puts c.to_yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment