This is how it was being done previously in the code:

https://github.com/puppetlabs/facter/blob/master/lib/facter/util/ip.rb#L131

Not sure what to say.