 <blockquote> <p><em>Is there some kind of "interpolate string" function, where I can add hash k-v pairs to an existing hash.</em></p> </blockquote> <p>No need for <em>interpolation</em>.</p> <p>Do this:-</p> <pre><code> merge(attribute_name =&gt; stuff) </code></pre> <blockquote> <p><em>Another thing, what happens in this function is that I have an empty array called "scores", fill it up with the candidate+score hashes, and return the array scores at the end, is there some kind of syntactic sugar or something for this?</em></p> </blockquote> <pre><code>attribute_name = "key_i_want" candidates.each_with_object([]) do |candidate,scores| scores.push candidate.attributes.merge(attribute_name =&gt; stuff) end </code></pre>