sonic-pi
https://github.com/sonic-pi-net/sonic-pi
C++
Code. Music. Live.
Rugged::Tree#walk
Walk +tree+ with the given mode (either +:preorder+ or +:postorder+) and yield
to +block+ every entry in +tree+ and all its subtrees, as a +Hash+. The +block+
also takes a +root+, the relative path in the traversal, starting from the root
of the original tree.
If the +block+ returns a falsy value, that entry and its sub-entries (in the case
of a folder) will be skipped for the iteration.
If no +block+ is given, an +Iterator+ is returned instead.
tree.walk(:postorder) { |root, entry| puts "#{root}#{entry[:name]} [#{entry[:oid]}]" }
generates:
USAGE.rb [02bae86c91f96b5fdb6b1cf06f5aa3612139e318]
ext [23f135b3c576b6ac4785821888991d7089f35db1]
ext/rugged [25c88faa9302e34e16664eb9c990deb2bcf77849]
ext/rugged/extconf.rb [40c1aa8a8cec8ca444ed5758e3f00ecff093070a]
...Edit
git clone [email protected]:sonic-pi-net/sonic-pi.git
cd sonic-pi
open app/server/ruby/vendor/rugged-1.7.1/ext/rugged/rugged_tree.c
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Rugged--Tree-walk-for-pr
# Commit to gitgit add app/server/ruby/vendor/rugged-1.7.1/ext/rugged/rugged_tree.cgit commit -m "better docs for Rugged::Tree#walk"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Rugged--Tree-walk-for-pr
hub pull-request
# Celebrate!