-----Messaggio originale----- Da: Jeremy Hinegardner [mailto:jeremy / hinegardner.org] Inviato: mercoled16 novembre 2011 07:02 A: ruby-talk ML Oggetto: Re: search through a csv file On Wed, Nov 16, 2011 at 06:15:33AM +0900, Yossef Mendelssohn wrote: > On Nov 15, 2:14?pm, Jeremy Hinegardner <jer... / hinegardner.org> wrote: > > > > ? ? ? matches = csv.find_all do |row| ? ? ? ? match = true ? ? ? ? > > search_criteria.keys.each do |key| ? ? ? ? ? match = match && ( > > row[key] == search_criteria[key] ) ? ? ? ? end ? ? ? ? match ? ? ? > > end > > search_criteria.all? { |k, v| row[k] == v } > > I actually had to check out Hash#all? to see if it worked the way I > thought. I've never had a reason to use it before. Ah, learning something new, loving it :-). -- ======================================================================== Jeremy Hinegardner jeremy / hinegardner.org -- Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f Sponsor: Conto Arancio al 4,20%. Soldi sempre disponibili, zero spese, aprilo in due minuti! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid923&d)-12