title: Change Key Positions in Ruby Hash
body: <p>I have the following hash:</p>
  
  <pre><code>my_hash = {
    "redis_1"=&gt;{"group"=&gt;"Output", "name"=&gt;"Redis", "parameters"=&gt;{"redis_db"=&gt;2, "redis_password"=&gt;"&lt;password&gt;"}},
    "file_1"=&gt;{"name"=&gt;"File", "group"=&gt;"Output", "parameters"=&gt;{"file"=&gt;"/opt/var/lib/bots/file-output/ctt.txt", "hierarchical_output"=&gt;false}}
  }
  </code></pre>
  
  <p>And I would like to move the key <code>parameters</code> in each inner hash to the first position, something like this:</p>
  
  <pre><code>my_hash = {
    "redis_1"=&gt;{"parameters"=&gt;{"redis_db"=&gt;2, "redis_password"=&gt;"&lt;password&gt;"}, "group"=&gt;"Output", "name"=&gt;"Redis"},
    "file_1"=&gt;{"parameters"=&gt;{"file"=&gt;"/opt/var/lib/bots/file-output/ctt.txt", "hierarchical_output"=&gt;false}, "name"=&gt;"File", "group"=&gt;"Output"}
  }
  </code></pre>
  
  <p>I have the following code:</p>
  
  <pre><code>my_hash.each_pair do |key, value|
    value.sort_by {|k, v| k == "parameters" ? 0 : 1}
  end
  </code></pre>
  
  <p>I'm not getting any errors, but this code doesn't do anything and I'm quite lost on how to reach the output that I want.</p>