lib/refinements/hashes.rb in refinements-7.1.0 vs lib/refinements/hashes.rb in refinements-7.2.0

- old
+ new

@@ -1,9 +1,8 @@ # frozen_string_literal: true module Refinements - # Refinements for hashes. module Hashes refine Hash do def except *keys reject { |key, _value| keys.include? key } end @@ -11,15 +10,14 @@ def except! *keys replace except(*keys) end def symbolize_keys - dup.symbolize_keys! + reduce({}) { |hash, (key, value)| hash.merge key.to_sym => value } end def symbolize_keys! - keys.each { |key| self[key.to_sym] = delete key } - self + replace symbolize_keys end def deep_merge other dup.deep_merge! other end