Class: GitDB::Objects::Commit

Inherits:
Base
  • Object
show all
Defined in:
lib/git-db/objects/commit.rb

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary (collapse)

Methods inherited from Base

#initialize, #inspect, #sha

Constructor Details

This class inherits a constructor from GitDB::Objects::Base

Instance Method Details

- (Object) author



3
4
5
# File 'lib/git-db/objects/commit.rb', line 3

def author
  attributes['author'].first
end

- (Object) committer



7
8
9
# File 'lib/git-db/objects/commit.rb', line 7

def committer
  attributes['committer'].first
end

- (Object) message



11
12
13
# File 'lib/git-db/objects/commit.rb', line 11

def message
  data.split("\n\n", 2).last
end

- (Object) parents



15
16
17
# File 'lib/git-db/objects/commit.rb', line 15

def parents
  attributes['parent']
end

- (Object) properties



19
20
21
# File 'lib/git-db/objects/commit.rb', line 19

def properties
  [:tree, :parents, :author, :committer, :message]
end

- (Object) raw



23
24
25
# File 'lib/git-db/objects/commit.rb', line 23

def raw
  "commit #{data.length}\000#{data}"
end

- (Object) tree



31
32
33
# File 'lib/git-db/objects/commit.rb', line 31

def tree
  attributes['tree'].first
end

- (Object) type



27
28
29
# File 'lib/git-db/objects/commit.rb', line 27

def type
  GitDB::OBJ_COMMIT
end