On 16 July 2010 13:48, Ram <yourstruly.vi...@gmail.com> wrote: > Anyone know a function that loops through an array and returns true if > any one element satisfies the condition but false if none satisfy the > condition? And it should do this in one line. Something like
You probably want ".detect" http://ruby-doc.org/core/classes/Enumerable.html#M003123 any_bot_follower = followers.detect(false) { |f| f.bot? } -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.