Created
September 5, 2012 22:31
-
-
Save burtlo/3646485 to your computer and use it in GitHub Desktop.
Working with YAML
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
name: 'La Crosse, WI' | |
code: LSE | |
directions: http://g.co/maps/62ufz | |
image: 'lacrosse-image.jpg' | |
website: http://www.cityoflacrosse.org/index.aspx?NID=851 | |
rental_cars: http://www.cityoflacrosse.org/index.aspx?NID=882 | |
description: La Crosse is the closest flight destination. It is right | |
on the Mississippi and about an hour away. It is a small airport so we | |
<strong>definitely recommend</strong> making a rental car reservation ahead of time. |
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' | |
yaml_data = YAML.load_file "data.yml" | |
# puts yaml_data["description"] | |
# | |
puts yaml_data.to_yaml | |
File.open("new_data.yml","w") do |file| | |
file.puts yaml_data.to_yaml | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment