Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Prism::Node#breadth_first_search

breadth_first_search() { |node| ... }

Returns the first node that matches the given block when visited in a depth-first search. This is useful for finding a node that matches a particular condition.

Example
node.breadth_first_search { |node| node.node_id == node_id }