From: Robert Klemme Date: 2009-04-06T23:09:22+09:00 Subject: Re: how to dynamically create search term for array.find_all On 06.04.2009 12:28, Adam Akhtar wrote: > ahh robert, sorry i missed your reply there, i was looking at > unrefreshed page from earlier today. No problem. > Many thanks for your response too. Im going to use that tip above plus > the odd sprinkling of eval("") for the conditions. I am not sure I get why you want to use eval. I try to avoid whenever possible. Why do you believe you need it? > i noticed you used to_set. Ive never used sets before. Is there a reason > why you chose that over a standard array? Set has O(1) lookup (because it is backed by a hash table internally), while an Array has O(1). Whether it makes a difference in practice needs to be measured. But if your number of categories grows then it's almost certainly more efficient then an Array. Of course, if you get categories in an Array you pay the extra price for the conversion. If you can avoid that by directly passing a Set to the method then this would be better of course. Kind regards robert -- remember.guy do |as, often| as.you_can - without end