rubocop

https://github.com/bbatsov/rubocop

Ruby

A Ruby static code analyzer, based on the community Ruby style guide.

RuboCop::NodePattern::Macros#def_node_search

Define a method which recurses over the descendants of an AST node,
checking whether any of them match the provided pattern

If the method name ends with '?', the new method will return `true`
as soon as it finds a descendant which matches. Otherwise, it will
yield all descendants which match.

Source | Google | Stack overflow

Edit

git clone [email protected]:bbatsov/rubocop.git

cd rubocop

open lib/rubocop/node_pattern.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-RuboCop--NodePattern--Macros-def_node_search-for-pr


# Commit to git

git add lib/rubocop/node_pattern.rbgit commit -m "better docs for RuboCop::NodePattern::Macros#def_node_search"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-RuboCop--NodePattern--Macros-def_node_search-for-pr

hub pull-request


# Celebrate!