From: Thomas Uehlinger Date: 2003-12-29T19:59:54+09:00 Subject: Re: An addition to Array (or Enumerable)? On Mon, 2003-12-29 at 02:51, Dave Thomas wrote: > On Dec 28, 2003, at 18:15, Gennady wrote: > > > Strange, ri 1.8b claims that Array#select([anIndex]*) may be used, > > however I got this error: > > It changed... :) > > The new ri has it right: > > > dave[ruby/ruby 17:06:31] ri -f bs Array.select > ----------------------------------------------------------- Array#select > array.select {|i| block } -> an_array > ------------------------------------------------------------------------ > Invokes the block passing in successive elements from arr, > returning an array containing those elements for which the block > returns a true value (equivalent to Enumerable#select). > The text is ok. > a = %w{ a b c d e f } > a.select(1, 3, 5) #=> ["b", "d", "f"] > a.select(1, 3, 5, 7) #=> ["b", "d", "f", nil] > a.select(-1, -3, -5, -7) #=> ["f", "d", "b", nil] But these examples don't work in 1.9.0 > a.select {|v| v =~ /[aeiou]/} #=> ["a", "e"] > This one is ok again. -- Thomas Uehlinger