------ art_14352_1589857.1203460192038 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/19/08, Leslie Viljoen <leslieviljoen / gmail.com> wrote: > > I often make use of this idiom to add something to an array in a hash of > arrays: > > @categories } > > pagelist.each do |resource| > @categories[resource.tag] || ] > @categories[resource.tag] << resource > end > > > .. is there a better way? Can the two @categories lines > be made into one? @categories } pagelist.each do |resource| (@catetegories[resource.tag] || ]) << resource end Christopher ------ art_14352_1589857.1203460192038--