title: Iterating through Hash to output an unordered list
body: <p>I have a Hash where the majority of it is filled with a key with two values associated with the key. There is also another hash within this Hash which is where I've been stuck.</p>
  
  <p>Lets say the hash looks like:</p>
  
  <pre><code>{'sports'=&gt;['football', 'basketball'], 'season'=&gt;['summer','fall'], 'data'=&gt;[{'holiday'=&gt;'Christmas', 'genre' =&gt; 'Comedy'}, {'holiday'=&gt;'Thanksgiving', 'genre' =&gt; 'Action'}]}
  </code></pre>
  
  <p>The output should look like:</p>
  
  <pre><code>Sports
    - football
    - basketball
  Season
    - summer
    - fall
  Holiday
    - Christmas
    - Thanksgiving
  Genre
    - Comedy
    - Action
  </code></pre>
  
  <p>So far I have a helper that gives me everything except the <code>data</code> section.</p>
  
  <pre><code>def output_list_from(hash)
    return if hash.empty?
  
    content_tag(:ul) do
      hash.map do |key, values|
        content_tag(:li, key.to_s.humanize) +
  
        content_tag(:ul) do
          # if values.is_a?(Hash)...
          content_tag(:li, values.first) +
          content_tag(:li, values.last)
        end
      end.join.html_safe
    end.html_safe
  end
  </code></pre>
  
  <p>This returns the output:</p>
  
  <pre><code>Sports
    - football
    - basketball
  Season
    - summer
    - fall
  Data
    - {'holiday'=&gt;'Christmas', 'genre' =&gt; 'Comedy'}
    - {'holiday'=&gt;'Thanksgiving', 'genre' =&gt; 'Action'}
  </code></pre>
  
  <p>Which of course makes sense...so I've tried to check in the loop if the <code>value</code> is a Hash, but the way it's set up has tricked me. I think it's be easier if I knew what the hash would look like everytime, but it would be a new hash each time. One time there could be a <code>holiday</code> within data and the other time there could be both <code>holiday</code> and <code>genre</code>.</p>
  
  <p>Any advice would be appreciated.</p>