How to check if an object is present in an array in Ruby?