あんたcollect!/map!の意味わかってるか?
ar.map! { |i|
if i == 2 then ar << 4 end
if i == 4 then ar << 5 end
i
}
なら期待通りになると思うよ。