diff options
| author | Daniel Doubrovkine (dB.) <dblock@dblock.org> | 2021-11-08 03:20:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-08 03:20:14 +0000 |
| commit | 796f9446fe3313685fe1a5c74052e1e942d170a2 (patch) | |
| tree | 893d8fab82017f8e3ea7e8d9903a069935b03770 /lib | |
| parent | e9c577161b09bb1915c55a9045cbcc1435cb69a8 (diff) | |
| parent | 9ba96e03a8b5baa098c7ac6841e4c021b02f1910 (diff) | |
| download | hashie-796f9446fe3313685fe1a5c74052e1e942d170a2.tar.gz | |
Merge pull request #545 from jackjennings/master
Add #except under Ruby 3
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/hashie/extensions/indifferent_access.rb | 7 | ||||
| -rw-r--r-- | lib/hashie/mash.rb | 7 |
2 files changed, 14 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) diff --git a/lib/hashie/mash.rb b/lib/hashie/mash.rb index f72633d..d5cb308 100644 --- a/lib/hashie/mash.rb +++ b/lib/hashie/mash.rb @@ -351,6 +351,13 @@ module Hashie end end + with_minimum_ruby('3.0.0') do + def except(*keys) + string_keys = keys.map { |key| convert_key(key) } + self.class.new(super(*string_keys)) + end + end + protected def method_name_and_suffix(method_name) |
