title: hash assignment when (key => value) are stored in an array? (ruby)
body: <p>I have <strong>hash (@post) of hashes</strong> where I want to keep the order of the hash's keys in the array (@post_csv_order) and also want to keep the <strong>relationship key => value in the array</strong>. </p>
  
  <p>I don't know the final number of both @post hashes and key => value elements in the array.</p>
  
  <p>I don't know how to assign the hash in a loop for all elements in the array. One by one <code>@post_csv_order[0][0] =&gt; @post_csv_order[0][1]</code> works nicely. </p>
  
  <pre><code>#  require 'rubygems'
  require 'pp'
  
  @post = {}
  
  forum_id = 123           #only sample values.... to make this sample script work
  post_title = "Test post"
  
  @post_csv_order = [
    ["ForumID" , forum_id],
    ["Post title", post_title]  
  ]
  
  if @post[forum_id] == nil
    @post[forum_id] = {
      @post_csv_order[0][0] =&gt; @post_csv_order[0][1],
      @post_csv_order[1][0] =&gt; @post_csv_order[1][1]
      #@post_csv_order.map {|element| element[0] =&gt; element[1]}
      #@post_csv_order.each_index {|index|        @post_csv_order[index][0] =&gt; @post_csv_order[index][1] }
    }
  end
  
  pp @post
  </code></pre>
  
  <p>desired hash assignment should be like that</p>
  
  <p><strong><code>{123=&gt;{"Post title"=&gt;"Test post", "ForumID"=&gt;123}}</code></strong></p>