Class: Gitrb::Commit
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#committer ⇒ Object
Returns the value of attribute committer.
-
#message ⇒ Object
Returns the value of attribute message.
-
#parents ⇒ Object
Returns the value of attribute parents.
-
#tree ⇒ Object
Returns the value of attribute tree.
Attributes inherited from GitObject
Instance Method Summary collapse
- #date ⇒ Object
- #dump ⇒ Object
-
#initialize(options = {}) ⇒ Commit
constructor
A new instance of Commit.
- #save ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Methods inherited from GitObject
#==, factory, #git_object, inherited
Constructor Details
#initialize(options = {}) ⇒ Commit
Returns a new instance of Commit.
6 7 8 9 10 11 12 13 14 |
# File 'lib/gitrb/commit.rb', line 6 def initialize( = {}) super() @parents = [[:parents]].flatten.compact @tree = [:tree] @author = [:author] @committer = [:committer] @message = [:message] parse([:data]) if [:data] end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
4 5 6 |
# File 'lib/gitrb/commit.rb', line 4 def @author end |
#committer ⇒ Object
Returns the value of attribute committer.
4 5 6 |
# File 'lib/gitrb/commit.rb', line 4 def committer @committer end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/gitrb/commit.rb', line 4 def @message end |
#parents ⇒ Object
Returns the value of attribute parents.
4 5 6 |
# File 'lib/gitrb/commit.rb', line 4 def parents @parents end |
#tree ⇒ Object
Returns the value of attribute tree.
4 5 6 |
# File 'lib/gitrb/commit.rb', line 4 def tree @tree end |
Instance Method Details
#date ⇒ Object
20 21 22 |
# File 'lib/gitrb/commit.rb', line 20 def date (committer && committer.date) || ( && .date) end |
#dump ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/gitrb/commit.rb', line 29 def dump [ "tree #{tree.id}", @parents.map { |p| "parent #{p.id}" }, "author #{.dump}", "committer #{committer.dump}", '', ].flatten.join("\n") end |
#save ⇒ Object
24 25 26 27 |
# File 'lib/gitrb/commit.rb', line 24 def save repository.put(self) id end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/gitrb/commit.rb', line 38 def to_s id end |
#type ⇒ Object
16 17 18 |
# File 'lib/gitrb/commit.rb', line 16 def type :commit end |