From: dblack@... Date: 2006-09-10T21:03:17+09:00 Subject: Re: How about Enumerable#find_pattern? Hi -- On Sun, 10 Sep 2006, A. S. Bradbury wrote: > Ignore the name, I don't really know what it's best to call it. Basically I've > been thinking it might be useful if Enumerable had a method to efficiently > search for a pattern in an Enumerable object. Existing methods like #find and > #grep work only on matching a single object. #find, yes, but #grep does something similar to what I understand you to be describing: %w{a b c}.grep(/./) => ["a", "b", "c"] irb(main):002:0> str = "a\nb\nc" => "a\nb\nc" irb(main):003:0> str.grep(/./) => ["a\n", "b\n", "c"] David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org