title: Read data from yaml file and produce an array in ruby
body: <p>I have the following data in a yaml file - </p>
  
  <pre><code>---
  - :Subject_list 
      Subject 1: 
       :Act 1: A
       :Act 2: B
      Subject 2: 
       :Skill 1: 
         :Act 1: B
         :Act 2: B  
       :Skill 2:
         :Act 1: B
  </code></pre>
  
  <p>I need to read data from this file and and generate an output which is given below - 
  For subject 1 it will be like this as it has no skill level. Meaning the first element of the array is null.</p>
  
  <pre><code>  ["","Act 1", "A"], ["","Act 2", "B"]
  </code></pre>
  
  <p>For the second subject it will be like this - </p>
  
  <pre><code>  ["Skill 1","Act 1", "B"], ["","Act 2" "B"],["Skill 2","Act 1", "B"]
  </code></pre>
  
  <p>I am using these values to generate a prawn pdf table. Any help is greatly appreciated. </p>
  
  <p>I tried doing this - </p>
  
  <pre><code>data=YAML::load(File.read("file.yaml"));
  subject = data[:Subject_list]
  sub_list =["Subject 1", "Subject 2"]
  
    sub_list.each do |sub|
        sub_data = []
        sub_data = subject["#{sub}"]
           # I convert the list symbol to an array, so i can loop through the sub     activities. 
           #I need some direction here as how to check whether the symbol will be a skill or activity
        end
  </code></pre>
  
  <p>Cheers!!</p>