Added Luka's console message colouring code

This commit is contained in:
Maruno17
2021-11-02 23:27:42 +00:00
parent 50d999e7da
commit c392f8c236
11 changed files with 223 additions and 74 deletions

View File

@@ -100,6 +100,36 @@ class Array
end
end
#===============================================================================
# class Hash
#===============================================================================
class Hash
def deep_merge(hash)
h = self.clone
# failsafe
return h if !hash.is_a?(Hash)
for key in hash.keys
if self[key].is_a?(Hash)
h.deep_merge!(hash[key])
else
h = hash[key]
end
end
return h
end
def deep_merge!(hash)
return if !hash.is_a?(Hash)
for key in hash.keys
if self[key].is_a?(Hash)
self[key].deep_merge!(hash[key])
else
self[key] = hash[key]
end
end
end
end
#===============================================================================
# module Enumerable
#===============================================================================