sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

Rugged::Tree#[]

Return one of the entries from a tree as a +Hash+. If +e+ is a number, the +e+nth entry
from the tree will be returned. If +e+ is a string, the entry with that name
will be returned.

If the entry doesn't exist, +nil+ will be returned.

  tree[3] #=> {:name => "foo.txt", :type => :blob, :oid => "d8786bfc97485e8d7b19b21fb88c8ef1f199fc3f", :filemode => 0}
  tree['bar.txt'] #=> {:name => "bar.txt", :type => :blob, :oid => "de5ba987198bcf2518885f0fc1350e5172cded78", :filemode => 0}
  tree['baz.txt'] #=> nil

Source | Google | Stack overflow

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 branch

git checkout -b -your-name--update-docs-Rugged--Tree----for-pr


# Commit to git

git add app/server/ruby/vendor/rugged-1.7.1/ext/rugged/rugged_tree.cgit commit -m "better docs for Rugged::Tree#[]"


# Open pull request

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

hub fork

git push <your name> -your-name--update-docs-Rugged--Tree----for-pr

hub pull-request


# Celebrate!