title: Convert hash to string in ruby
body: <pre><code>input = {:a=&gt;{:type=&gt;"list", :values=&gt;[{:type=&gt;"b", :id=&gt;"123"}, {:type=&gt;"b", :id=&gt;"456"}]}}
  </code></pre>
  
  <p>output should be as follows</p>
  
  <pre><code>{:new_name=&gt;"123,456"}
  </code></pre>
  
  <p>I tried using inject like this.Not sure what to include inside the block</p>
  
  <pre><code>input.tap do |e|
   e[:a].try(:[], :values).inject({}) do |h, obj|
     h[:new_name] = **
   end
  end
  </code></pre>