From: Tim Hunter Date: 2007-07-31T07:22:48+09:00 Subject: Re: array.include? Gordon Thiesfeld wrote: > On Jul 30, 11:17 am, Jeffrey Bowen wrote: > >> if @status_array.include? @status_number >> else >> @status_array << @status_number >> end >> > > How about not checking at all? Just put them all in there and then > use @status_array.uniq! when necessary? I'm not advocating this. > Just curious what people think. > > > If it was me, I'd just use a hash instead of an array, with @status_number as the key and anything (1, for example) as the value. Let the hash object figure out if @status_number is already a key. It'll be fast, and any time you need a list of status_numbers, just call hash.keys. -- RMagick OS X Installer [http://rubyforge.org/projects/rmagick/] RMagick Hints & Tips [http://rubyforge.org/forum/forum.php?forum_id=1618] RMagick Installation FAQ [http://rmagick.rubyforge.org/install-faq.html]