From: dblack@... Date: 2006-10-30T03:49:44+09:00 Subject: Re: !x.include? y Hi -- On Mon, 30 Oct 2006, Vincent Fourmond wrote: > Giles Bowkett wrote: > >> list.reject! {|thing| not list_of_acceptable_values.include? >> thing.attribute} >> >> is there a nicer way to do it? > > list.select {|thing| list_of_acceptable_values.include? thing.attribute > } ?? > > But then you need to reassign list, since I don't know of any select! This would be a nice use for delete_unless. 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