Skip to content

Instantly share code, notes, and snippets.

class Wildcards < Struct.new(:hash, :definitions)
def replace(a = hash, b = definitions)
a.merge(b) do |_, left, right|
if left.is_a? Hash
compare(left, right)
else
left == '*' ? right : left
end
end
end