rubocop
https://github.com/bbatsov/rubocop
Ruby
A Ruby static code analyzer, based on the community Ruby style guide.
RuboCop::NodePattern::Macros#def_node_matcher
Define a method which applies a pattern to an AST node The new method will return nil if the node does not match If the node matches, and a block is provided, the new method will yield to the block (passing any captures as block arguments). If the node matches, and no block is provided, the new method will return the captures, or `true` if there were none.
Edit
git clone [email protected]:bbatsov/rubocop.git
cd rubocop
open lib/rubocop/node_pattern.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-RuboCop--NodePattern--Macros-def_node_matcher-for-pr
# Commit to gitgit add lib/rubocop/node_pattern.rbgit commit -m "better docs for RuboCop::NodePattern::Macros#def_node_matcher"
# Open pull requestgem 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_matcher-for-pr
hub pull-request
# Celebrate!