Method: Fast.capture
- Defined in:
- lib/fast.rb
.capture(pattern, node) ⇒ Array<Object>
Only captures from a search
277 278 279 280 281 282 283 284 285 |
# File 'lib/fast.rb', line 277 def capture(pattern, node) if (match = match?(pattern, node)) match == true ? node : match else node.each_child_node .flat_map { |child| capture(pattern, child) } .compact.flatten end end |