Replace `inject` usage with `each_with_object`.