diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/hashie/extensions/dash/property_translation.rb | 7 | ||||
| -rw-r--r-- | lib/hashie/extensions/indifferent_access.rb | 7 | ||||
| -rw-r--r-- | lib/hashie/mash.rb | 8 |
3 files changed, 20 insertions, 2 deletions
diff --git a/lib/hashie/extensions/dash/property_translation.rb b/lib/hashie/extensions/dash/property_translation.rb index 8149faa..69a2d71 100644 --- a/lib/hashie/extensions/dash/property_translation.rb +++ b/lib/hashie/extensions/dash/property_translation.rb @@ -153,7 +153,12 @@ module Hashie def []=(property, value) if self.class.translation_exists? property send("#{property}=", value) - super(property, value) if self.class.properties.include?(property) + + if self.class.transformation_exists? property + super property, self.class.transformed_property(property, value) + elsif self.class.properties.include?(property) + super(property, value) + end elsif self.class.transformation_exists? property super property, self.class.transformed_property(property, value) elsif property_exists? property diff --git a/lib/hashie/extensions/indifferent_access.rb b/lib/hashie/extensions/indifferent_access.rb index 2ff5f28..7702c14 100644 --- a/lib/hashie/extensions/indifferent_access.rb +++ b/lib/hashie/extensions/indifferent_access.rb @@ -167,6 +167,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 6ab6e9a..d5cb308 100644 --- a/lib/hashie/mash.rb +++ b/lib/hashie/mash.rb @@ -62,7 +62,6 @@ module Hashie # mash.author # => <Mash> # class Mash < Hash - include Hashie::Extensions::PrettyInspect include Hashie::Extensions::RubyVersionCheck extend Hashie::Extensions::KeyConflictWarning @@ -352,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) |
