News for hackers. Stuff that matters.
Re:Anti-Pattern: Iteratively Building a Collection by radiospiel on Wednesday December 04, 2013 @01:28PM (#6848958)
There are some issues with the "good" examples; e.g.

def signer_keys_and_uids signers.inject({}) do |result, signer| result.merge(signer.key_id => signer.uids) end end

builds not only one but two new hash objects on each iteration, while the "bad" code does neither. Array to Hash is probably best done using Hash[]

There are no comments on this comment yet.