Module: Tins::DeepTransform
- Included in:
- HashSymbolizeKeysRecursive
- Defined in:
- lib/tins/deep_transform.rb
Overview
DeepTransform provides a robust engine for traversing an object tree and applying a transformation to each node iteratively, preventing stack overflows.
Instance Method Summary collapse
-
#deep_transform(key: nil, value: nil, circular: nil) ⇒ Object
Transforms an object and its children using the provided lambdas.
Instance Method Details
#deep_transform(key: nil, value: nil, circular: nil) ⇒ Object
Transforms an object and its children using the provided lambdas. This implementation uses an iterative bottom-up approach to avoid SystemStackError.
21 22 23 24 |
# File 'lib/tins/deep_transform.rb', line 21 def deep_transform(key: nil, value: nil, circular: nil) block_given? and raise ArgumentError, '&block not supported' _transform_iterative(self, key: key, value: value, circular: circular) end |