From: "ara.t.howard" Date: 2008-04-13T09:51:06+09:00 Subject: Re: Hash#slice On Apr 12, 2008, at 5:12 PM, Trans wrote: > Let see.... Facets: > > class Hash > > # Returns a new hash with only the given keys. > > def slice(*keep_keys) > h = {} > keep_keys.each do |key| > h[key] = fetch(key) > end > h > end > > # Replaces hash with a new hash having only the given keys. > # This return the hash of keys removed. > > def slice!(*keep_keys) > removed = except(*keep_keys) > replace(slice(*keep_keys)) > removed > end > > end okay, you should add the block form ;-) headers.slice{|k,| k =~ %r/^HTTP_/} handy..... cheers. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama