./lib/hash_wia/module.rb in hash_wia-0.8.4 vs ./lib/hash_wia/module.rb in hash_wia-0.8.5

- old
+ new

@@ -1,12 +1,6 @@ module HashWiaModule - def initialize hash=nil - if hash - hash.each { |k,v| self[k] = v } - end - end - # overload common key names with %i(size length zip minmax store cycle chunk sum uniq chain).each do |el| define_method el do self[el] end @@ -55,10 +49,12 @@ def clone Marshal.load(Marshal.dump(self)) end def merge hash - dup.tap do |h| + dup + .extend(HashWiaModule) + .tap do |h| hash.each { |k, v| h[k.to_s] = v } end end def merge! hash