Refactor with suggestion by rubocop.