Replaces a for..in statement with a .each iterator and associated closure.