title: How to iterate through a yaml hash structure in ruby?
body: <p>I have a hash mapping in my yaml file as below. How Can I iterate through it in simple ruby script? I would like to store the key in a variable and value in another variable in my ruby program during the iteration.  </p>
  
  <pre><code>source_and_target_cols_map:
   -
      com_id: community_id
      report_dt: note_date
      sitesection: site_section
      visitor_cnt: visitors
      visit_cnt: visits
      view_cnt: views
      new_visitor_cnt: new_visitors
  </code></pre>
  
  <p>the way i am getting the data from the yaml file is below:</p>
  
  <pre><code>#!/usr/bin/env ruby
  
  require 'yaml'
  
      config_options = YAML.load_file(file_name)
      @source_and_target_cols_map = config_options['source_and_target_cols_map']
  puts @source_and_target_cols_map
  </code></pre>