# New to YAML/Ruby

**URL:** <https://www.ruby-forum.com/t/new-to-yaml-ruby/147732>\
**Category:** Ruby\
**Created:** [September 4, 2008, 7:49pm UTC](https://www.ruby-forum.com/t/new-to-yaml-ruby/147732 "2008-09-04T19:49:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [September 4, 2008, 7:49pm UTC](https://www.ruby-forum.com/t/new-to-yaml-ruby/147732/1 "2008-09-04T19:49:02Z")

</div>

So, I have been interested in working in YAML but have found a very  
little amount of ruby specific resources. I wanted to incorporate YAML  
into a basic MADlib engine for the heck of it, but I’m not to keen on  
reading the rdocs… can anyone give me a basic run through on how you  
would go about loading a file, and checking to see if it has the basic  
variables of things like ‘story’ and ‘needed-words’?

---

<div class="post-metadata">

**Author:** ![enchanter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ce7236/32.png) [@enchanter](https://www.ruby-forum.com/u/enchanter)\
**Post date:** [September 4, 2008, 7:58pm UTC](https://www.ruby-forum.com/t/new-to-yaml-ruby/147732/2 "2008-09-04T19:58:12Z")

</div>

Tim M. wrote:

> So, I have been interested in working in YAML but have found a very  
> little amount of ruby specific resources. I wanted to incorporate YAML  
> into a basic MADlib engine for the heck of it, but I’m not to keen on  
> reading the rdocs… can anyone give me a basic run through on how you  
> would go about loading a file, and checking to see if it has the basic  
> variables of things like ‘story’ and ‘needed-words’?

If you have ri (or fastri or qri installed), you’ve got a good basic  
intro. Here’s the example from running ‘ri YAML’:

```
      require "yaml"

      test_obj = ["dogs", "cats", "badgers"]

      yaml_obj = YAML::dump( test_obj )
                          # -> ---
                               - dogs
                               - cats
                               - badgers
      ruby_obj = YAML::load( yaml_obj )
                          # => ["dogs", "cats", "badgers"]
      ruby_obj == test_obj
                          # => true

```

See also YAML.load and YAML.dump in the ri docs.
