title: How to merge hash of hashes and set default value if value don't exists
body: <p>I need to merge values of hash <strong>a</strong> into <strong>out</strong> with sort keys in  <strong>a</strong>.</p>
  
  <pre class="lang-rb prettyprint-override"><code>a = {"X"=&gt;{12=&gt;1, 11=&gt;4}, "Y"=&gt;{11=&gt;5}, "Z"=&gt;{12=&gt;5}}
  
  out = [
    {"X": [4, 1]},
    {"Y": [5, 0]},
    {"Z": [0, 5]},
  ]
  </code></pre>