Method: BBLib::HashPathProcs.class_based_proc
- Defined in:
- lib/hash_path/processors.rb
.class_based_proc(child, class_based, *methods) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/hash_path/processors.rb', line 47 def self.class_based_proc(child, class_based, *methods) child.replace_with( if class_based && child.node_class == Hash child.value.map { |k, v| [BBLib.recursive_send(k, *methods), v] }.to_h elsif class_based && child.node_class == Array child.children.values.flat_map { |v| class_based_proc(v, true, *methods) } else BBLib.recursive_send(child.value, *methods) end ) end |