title: How do I write values parsed from a CSV file to a YAML file?
body: <p>I want to write values parsed from a CSV file to a YAML file:</p>
  
  <pre><code>home_phone = row['HomePhone']
   if home_phone.length == 10  
    puts "First Name: #{row['first_Name']} - Home Phone: #{home_phone} -  Zip Code: #{zip_code}"
    elsif home_phone.length == 11 &amp;&amp; home_phone.start_with?('1')   
    home_phone.slice!(0)
        puts "First Name: #{row['first_Name']} - Home Phone: #{home_phone} -  Zip Code: #{zip_code}"   
    else  
        puts "First Name: #{row['first_Name']} - Home Phone: #{"0000000000"} -  Zip Code: #{zip_code}"      
    end
  </code></pre>
  
  <p>The above code is used for printing the details row-wise. The output obtained from the code is:</p>
  
  <pre><code>First Name: Douglas - Home Phone: 4252745000 -  Zip Code: 50309'
  
  'First Name: Aya - Home Phone: 9995901339 -  Zip Code: 90210'
  
  'First Name: Audrey - Home Phone: 0 -  Zip Code: 05667'
  </code></pre>
  
  <p>How can I write these values to a YAML file?</p>