lib/core/facets/hash/except.rb in facets-2.4.3 vs lib/core/facets/hash/except.rb in facets-2.4.4

- old
+ new

@@ -4,20 +4,24 @@ def except(*less_keys) slice(*keys - less_keys) end - # Replaces hash with new hash less the given keys. - # This returns the hash of keys removed. - # - # h = {:a=>1, :b=>2, :c=>3} - # h.except!(:a) #=> {:a=>1} - # h #=> {:b=>2,:c=>3} - # - def except!(*less_keys) - removed = slice(*less_keys) - replace(except(*less_keys)) - removed + unless defined?(::ActiveSupport) + + # Replaces hash with new hash less the given keys. + # This returns the hash of keys removed. + # + # h = {:a=>1, :b=>2, :c=>3} + # h.except!(:a) #=> {:a=>1} + # h #=> {:b=>2,:c=>3} + # + def except!(*less_keys) + removed = slice(*less_keys) + replace(except(*less_keys)) + removed + end + end end