Excuse me if I'm missing something, but doesn't the []= method on Hash return its argument anyway, so that prev would in fact be set to the rightmost member?
However, it seems to me that `prev` is not used for anything here, and could be removed.