Ezra Zygmuntowicz wrote: > Here are two handy methods for doing what you want: > > class Hash > # lets through the keys in the argument > # >> {:one => 1, :two => 2, :three => 3}.pass(:one) > # => {:one=>1} > def pass(*keys) > self.reject { |k,v| ! keys.include?(k) } > end > > # blocks the keys in the arguments > # >> {:one => 1, :two => 2, :three => 3}.block(:one) > # => {:two=>2, :three=>3} > def block(*keys) > self.reject { |k,v| keys.include?(k) } > end > end I wonder, are you aware that those are O(n^2)? Regards Stefan -- Posted via http://www.ruby-forum.com/.