Class: GitHack::CommitLineBuilder
- Inherits:
-
LineBuilder
- Object
- LineBuilder
- GitHack::CommitLineBuilder
- Defined in:
- lib/git-hack/commit_line_builder.rb
Instance Attribute Summary
Attributes inherited from LineBuilder
Instance Method Summary collapse
-
#initialize(data, index) ⇒ CommitLineBuilder
constructor
A new instance of CommitLineBuilder.
- #process_line ⇒ Object
Methods inherited from LineBuilder
Constructor Details
#initialize(data, index) ⇒ CommitLineBuilder
Returns a new instance of CommitLineBuilder.
7 8 9 10 11 |
# File 'lib/git-hack/commit_line_builder.rb', line 7 def initialize(data,index) super(data,index) @is_message = false @commit = { 'masseg' => '', parent => []} end |
Instance Method Details
#process_line ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/git-hack/commit_line_builder.rb', line 12 def process_line @is_message line = @data[@index] line = line.chomp if line == "" @is_message = !@is_message elsif @commit. << line+"\n" else data = line.split key = data.shift value = data.join(" ") if key == 'commit' @commit['sha'] = value end if key == 'parent' @commit[key] << value else end end end |