#1# Copyright (c) 2006-2025 Wade Alcorn - [email protected]2# Browser Exploitation Framework (BeEF) - https://beefproject.com3# See the file 'doc/COPYING' for copying permission4#5class Hash6# Recursively deep merge two hashes together7# @param [Hash] hash Hash to be merged8# @return [Hash] Combined hash9# @note Duplicate keys are overwritten by the value defined10# in the hash calling deep_merge (not the parameter hash)11# @note http://snippets.dzone.com/posts/show/470612def deep_merge(hash)13target = dup14hash.keys.each do |key|15if hash[key].is_a?(Hash) && self[key].is_a?(Hash)16target[key] = target[key].deep_merge hash[key]17next18end19target[key] = hash[key]20end21target22end23end242526