title: Writing values in hash to an array in a specific order
body: <p>So I have a bunch of hashes that look like this </p>
  
  <pre><code>{
   "key1"=&gt;"value1", 
   "key2"=&gt;"value2", 
   "key4"=&gt;"value4"
  }
  
  {
   "key1"=&gt;"value1", 
   "key3"=&gt;"value3", 
   "key4"=&gt;"value4"
  }
  </code></pre>
  
  <p>As you can see, not all of the hashes have all of the keys. Out of this, I need to get an array with all of the values, and the string "Not listed" in place of all of the missing values.</p>
  
  <p>I started writing some code like this:</p>
  
  <pre><code>result = []
  i = 0
  hash.each do |key, value|
      i+=1
      result &lt;&lt; value if key == "key" + i.to_s
  end
  </code></pre>
  
  <p>before I realized that this strategy was not going to work. Any suggestions?</p>
  
  <p>EDIT:</p>
  
  <p>Expected output for the first hash would be </p>
  
  <pre><code>["value1", "value2", "Not Listed", "value4"]
  </code></pre>
  
  <p>and for the second hash would be </p>
  
  <pre><code>["value1", "Not Listed", "value3", "value4"]
  </code></pre>