def convert(asset)
      ips = asset.split('-').map(&:strip)
      IPAddr.new(ips[0])
      IPAddr.new(ips[1]) if ips[1]
      IPRange.new(ips[0], ips[1])
    rescue ArgumentError => e
      if e.message == 'invalid address'
        HostName.new(asset)
      else
        raise "Unable to parse asset: '#{asset}'. #{e.message}"
      end
    end
def convert(asset)
      ips = asset.split('-').map(&:strip)
      IPAddr.new(ips[0])
      IPAddr.new(ips[1]) if ips[1]
      IPRange.new(ips[0], ips[1])
    rescue ArgumentError => e
      if e.message == 'invalid address'
        HostName.new(asset)
      else
        raise "Unable to parse asset: '#{asset}'. #{e.message}"
      end
    end
Convert a host or IP address to the corresponding HostName or IPRange
 class.

 If the String cannot be converted, it will raise an error.

 @param [String] asset String representation of an IP or host name.
 @return [IPRange|HostName] Valid class, if it can be converted.