Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Ruby Core and Standard Library Ruby Standard Library: Part 2 YAML

Cody Mumford
Cody Mumford
11,531 Points

Can't figure out how to assign the results of loading yaml_string in to another variable called treehouse.

I tried treehouse = yaml_string among other solutions.

yaml.rb
yaml_string = "---\n:name: Treehouse\n:location: Portland, OR\n"

require 'yaml'

YAML.load

1 Answer

Angela Visnesky
Angela Visnesky
20,927 Points

Hi Cody, I understand the frustration of trying a billion combinations. Here's the answer that worked for me:

require 'yaml'
yaml_string = "---\n:name: Treehouse\n:location: Portland, OR\n"
treehouse = YAML.load(yaml_string)

Here is a link to the documentation that explains YAML. (http://ruby-doc.org/stdlib-2.1.1/libdoc/yaml/rdoc/YAML.html)