global
def deep_dup(object)
def deep_dup(object) case object when Array object.map { |item| deep_dup(item) } when Hash object.transform_values { |value| deep_dup(value) } else object # only collections undergo modifications and need duping end end
def deep_dup(object) case object when Array object.map { |item| deep_dup(item) } when Hash object.transform_values { |value| deep_dup(value) } else object # only collections undergo modifications and need duping end end