Skip to content

Commit

Permalink
Documentation improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed Sep 28, 2008
1 parent c7fa10a commit 8830481
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/gash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ def gash; parent.gash if parent end

# Converts the +value+ to a Tree or a Blob, using some rules:
#
# == If +value+ is already a Tree or a Blob:
# ==== If +value+ is already a Tree or a Blob:
#
# * If +value+ comes from another repo, we load it and return a deep copy.
# * If +value+ got no parent, we simply return the same tree.
# * If +value+'s parent is +self+, we also return the same tree.
# * If +value+'s parent is something else, we return a duplicated tree.
#
# == If it's something else:
# ==== If it's something else:
#
# * If +value+ is a Hash, we create a Tree from it.
# * If it's not any of the former rules, we turn it into a string and create a Blob from it.
Expand Down Expand Up @@ -120,9 +120,15 @@ def normalize(value)
# tree.fetch("examples/test.rb")
# tree["examples/another.rb"] = "Content"
# tree.store("examples/another.rb", "Content") # Exactly the same as above.
#
# tree["examples"]["test.rb"] # Or, you could use this
#
# You can of course use <code>tree["examples"]["test.rb"]</code> if you prefer
# that.
# == Documentation
#
# The point of Tree is that it should be as close to Hash as possible.
# Therefore, methods which behaves exactly equally in Gash and Hash will
# not be documentated below. Please see the Ruby documentation if you
# wonder what you can do.
#
# <b>See also</b>: Helpers, Blob
class Tree < Hash
Expand Down Expand Up @@ -236,7 +242,7 @@ def delete(key)
def self.[](*val)
new.merge!(Hash[*val])
end

def ==(other)
if other.is_a?(Tree) && sha1 && other.sha1
sha1 == other.sha1
Expand Down

0 comments on commit 8830481

Please sign in to comment.