lib/cistern/hash.rb in cistern-1.0.1.pre3 vs lib/cistern/hash.rb in cistern-1.0.1.pre4
- old
+ new
@@ -4,10 +4,16 @@
keys.each{ |k| sliced[k] = hash[k] if hash.key?(k) }
end
end
def self.except(hash, *keys)
- hash.dup.except!(*keys)
+ Cistern::Hash.except!(hash.dup, *keys)
+ end
+
+ # Replaces the hash without the given keys.
+ def self.except!(hash, *keys)
+ hash.keys.each { |key| hash.delete(key) }
+ hash
end
def self.stringify_keys(object)
case object
when Hash