this part is quite hard to read what it actually do. how I probably write it (there is few open question like if @hosts really cannot be nil):
```
unless oldhn.empty?
  @hosts.each_pair do |ip, hostnames|
     hostname_lists = hostnames.map { |hn| hn.split(" ") }
     valid_hostname_lists = hostname_lists.reject { |hns| hns.include?(oldhn) }
     @hosts[ip] = valid_hostname_lists.map { |hns| hns.join(" ") }
  end
end
```

I know that it is old code, but when you touch it, it will be nice to improve it so next time we read it, it is easier to recognize what is going on.