> One thing detect doesn't do (for as far as I can see/test) is return a
> set that matches the detected data (e.g. when "blue" is found several
> times, using a regexp, it would only return the first instance where
> blue is detected).

Use Enumerable#select for that: array.select { |x| x.color =~ /blue/ }

Eloy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to