Class: GitDag::CommitNode

Inherits:
Node
  • Object
show all
Defined in:
lib/git-dag/commit_node.rb

Direct Known Subclasses

MergeNode

Instance Attribute Summary

Attributes inherited from Node

#parents

Instance Method Summary collapse

Constructor Details

#initialize(grit_commit) ⇒ CommitNode

Returns a new instance of CommitNode.



3
4
5
6
# File 'lib/git-dag/commit_node.rb', line 3

def initialize(grit_commit)
  @grit_commit = grit_commit
  @parents = []
end

Instance Method Details

#add_parent(parent) ⇒ Object



16
17
18
# File 'lib/git-dag/commit_node.rb', line 16

def add_parent(parent)
  @parents << parent
end

#dot_nodeObject



20
21
22
# File 'lib/git-dag/commit_node.rb', line 20

def dot_node
  %Q("#{short_sha1}")
end

#idObject



12
13
14
# File 'lib/git-dag/commit_node.rb', line 12

def id
  @grit_commit.id
end

#labelObject



8
9
10
# File 'lib/git-dag/commit_node.rb', line 8

def label
  %Q([color="#{color}"])
end