Method: Abstractivator::Trees#tree_map
- Defined in:
- lib/abstractivator/trees/tree_map.rb
#tree_map(h) {|config| ... } ⇒ Object
Transforms a tree at certain paths. The transform is non-destructive and reuses untouched substructure. For efficiency, it first builds a “path_tree” that describes which paths to transform. This path_tree is then used as input for a data-driven algorithm.
14 15 16 17 18 19 |
# File 'lib/abstractivator/trees/tree_map.rb', line 14 def tree_map(h) raise ArgumentError.new('Must provide a transformer block') unless block_given? config = BlockCollector.new yield(config) TransformTreeClosure.new(config).do_obj(h, config.get_path_tree) end |