Skip to content

Instantly share code, notes, and snippets.

@gnufied
Created June 6, 2010 15:05
Show Gist options
  • Save gnufied/427646 to your computer and use it in GitHub Desktop.
Save gnufied/427646 to your computer and use it in GitHub Desktop.
input
-----
emacs - records
vim - columns
wow
windowd and linux
windows - records
macs
output
------
emacs records
vim columns
wow
windowd and linux
windows records
macs
Or if you must tread your yml as simply a file then
----------------
data = File.open('test.yml','r+').readlines()
output_data = data.map do |line|
if line.include?('- columns') or line.include?('- records')
line.gsub(/-/, ' ')
else
line
end
end
File.open('test.yml','w') do |fl|
fl.write(output_data)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment