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 trialTodd MacIntyre
12,248 Points#to_yaml VS #dump
Are the #to_yaml and #dump methods in YAML effectively the same thing?
It seems as though my_hash.to_yaml
and YAML.dump(my_hash)
do the same exact thing.
1 Answer
Martin Cornejo Saavedra
18,132 PointsIf you check the doc at http://ruby-doc.org/stdlib-1.9.3/libdoc/yaml/rdoc/YAML.html you can see both (dump and to_yaml) can create yaml content.
Todd MacIntyre
12,248 PointsTodd MacIntyre
12,248 PointsYes, I'm aware they both output yaml, thus the origin of my question. I'm wondering if there are any specific technical differences or reasons to use one over the other. Thanks!