module LittleGhost::Support
Support collects small building blocks for LittleGhost extensions. They are available to applications that need the same cancellation, loading, callback, execution, and diagnostic behavior as the framework.
Public Instance Methods
Source
# File lib/little_ghost/support.rb, line 12 def deep_dup(value) case value when Hash value.each_with_object({}) { |(key, child), copy| copy[deep_dup(key)] = deep_dup(child) } when Array value.map { |child| deep_dup(child) } when String value.dup else value end end
Recursively duplicates hashes, arrays, and strings while preserving other values. Cyclic containers are not supported.