I want a single line of ruby (not using each) that will answer this question: Is there a follower_id of 2397558816 in this array?
myArray = [ #<Follower id: 1, username: "Prep Bootstrap", imageurl: "http://pbs.twimg.com//profile_images/2825468445/2a4...", user_id: "thefonso", follower_id: "2397558816", created_at: "2014-05-21 15:29:03", updated_at: "2014-05-21 15:29:03">, #<Follower id: 2, username: "JAVA Developer", imageurl: "http://pbs.twimg.com//profile_images/2825468445/2a4...", user_id: "thefonso", follower_id: "2352382640", created_at: "2014-05-21 15:29:05", updated_at: "2014-05-21 15:29:05"> ] I am convinced that there must be a ruby method or combo of such that can do this. Can this be done?
each, but usingany?,select,findas in some answers below all uses iteration. If the object is a hash, it is possible.