Skip to content

Commit 3654612

Browse files
author
scott Chacon
committed
added tree? blob? commit? tag? predicates for git objects
1 parent 8776627 commit 3654612

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/git/object.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ def archive(file = nil, opts = {})
5353
@base.lib.archive(@sha, file, opts)
5454
end
5555

56+
def tree?
57+
@type == 'tree'
58+
end
59+
60+
def blob?
61+
@type == 'blob'
62+
end
63+
64+
def commit?
65+
@type == 'commit'
66+
end
67+
68+
def tag?
69+
@type == 'tag'
70+
end
71+
5672
end
5773

5874

0 commit comments

Comments
 (0)