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

#authorObject



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

def author
  attributes['author'].first
end

#committerObject



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

def committer
  attributes['committer'].first
end

#messageObject



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

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

#parentsObject



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

def parents
  attributes['parent']
end

#propertiesObject



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

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

#rawObject



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

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

#treeObject



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

def tree
  attributes['tree'].first
end

#typeObject



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

def type
  GitDB::OBJ_COMMIT
end