Skip to content

Instantly share code, notes, and snippets.

@matschaffer
Created August 18, 2010 13:58
Show Gist options
  • Save matschaffer/534811 to your computer and use it in GitHub Desktop.
Save matschaffer/534811 to your computer and use it in GitHub Desktop.
def find_node_with_text(top, node_text)
node = top.detect { |node| node.text == node_text }
return node if node
find_node_with_text(top.children, node_text)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment