summaryrefslogtreecommitdiff
path: root/lib/hashie/extensions/indifferent_access.rb
diff options
context:
space:
mode:
authorJack Jennings <jack.jennings@leafly.com>2021-04-06 17:45:02 -0700
committerJack Jennings <jack.jennings@leafly.com>2021-11-02 12:57:54 -0700
commit9ba96e03a8b5baa098c7ac6841e4c021b02f1910 (patch)
tree811945a20cb508cbc6866b0dacad999c1486e7ed /lib/hashie/extensions/indifferent_access.rb
parent16eb591205092dab88d87673263ddf02014a350a (diff)
downloadhashie-9ba96e03a8b5baa098c7ac6841e4c021b02f1910.tar.gz
Add #except under Ruby 3
Ruby 3 adds the Hash#except method, which should return the correct Hashie object instance when called on a Mash or object using the Hashie::Extensions::IndifferentAccess mixin.
Diffstat (limited to 'lib/hashie/extensions/indifferent_access.rb')
-rw-r--r--lib/hashie/extensions/indifferent_access.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/hashie/extensions/indifferent_access.rb b/lib/hashie/extensions/indifferent_access.rb
index d6b9da3..c2c7888 100644
--- a/lib/hashie/extensions/indifferent_access.rb
+++ b/lib/hashie/extensions/indifferent_access.rb
@@ -162,6 +162,13 @@ module Hashie
end
end
+ with_minimum_ruby('3.0.0') do
+ def except(*keys)
+ string_keys = keys.map { |key| convert_key(key) }
+ super(*string_keys)
+ end
+ end
+
protected
def hash_lacking_indifference?(other)