From: Robert Dober Date: 2010-04-16T00:05:22+09:00 Subject: Re: Blocks and local variable creation On Thu, Apr 15, 2010 at 12:17 PM, John Lane wrote: > Hello, > > But I don't think it is good idiomatic ruby code. Is there a better way > to write this type of thing ? I do not reallly understand why you want nil, instead of [], but apart of this I would do select{|_,v| v.include? item}.map(&:first) or if you insist inject( nil ){ |r,(k,v)| v.include?( item ) ? (r||[]) << k : r } > -- > Posted via http://www.ruby-forum.com/. > > -- The best way to predict the future is to invent it. -- Alan Kay