Module: LittleGhost::Support
- Defined in:
- lib/little_ghost/support.rb,
lib/little_ghost/support/loader.rb,
lib/little_ghost/support/executor.rb,
lib/little_ghost/support/redactor.rb,
lib/little_ghost/support/callbacks.rb,
lib/little_ghost/support/content_capture.rb,
lib/little_ghost/support/class_attributes.rb,
lib/little_ghost/support/output_truncation.rb,
lib/little_ghost/support/cancellation_token.rb,
lib/little_ghost/support/interruptible_stream.rb
Overview
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.
Defined Under Namespace
Modules: ClassAttributes, OutputTruncation Classes: Callbacks, CancellationToken, ContentCapture, Executor, InterruptibleStream, Loader, Redactor
Class Method Summary collapse
-
.deep_dup(value) ⇒ Object
Recursively duplicates hashes, arrays, and strings while preserving other values.
Class Method Details
.deep_dup(value) ⇒ Object
Recursively duplicates hashes, arrays, and strings while preserving other values. Cyclic containers are not supported.
12 13 14 15 16 17 18 19 20 21 22 23 |
# 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 |