Fastest way to find a String into an array of string
You could use the Array#include method to return you a true/false.
http://ruby-doc.org/core-1.9.3/Array.html#method-i-include-3F
if ips.include?(ip) #=> true puts 'ip exists'else puts 'ip doesn\'t exist'end
A faster way would be:
if ips.include?(ip) puts "ip exists" return 1else puts "ip doesn't exist" return nilend