We should not shell out to get this information.  Something like Facter, perhaps?  Something like the following will give you an array of IP addresses to do something useful with.

Facter.value('interfaces').split(',').collect {|i| Facter.value("ipaddress_#{i}") }

The reason for this is that I can't guarantee this will work on all platforms that this module is supported on.