Class: Wlog::GitCommitParser
- Inherits:
-
Object
- Object
- Wlog::GitCommitParser
- Defined in:
- lib/wlog/tech/git_commit_parser.rb
Overview
Class Method Summary collapse
-
.parse(log_s) ⇒ Object
A list of GitCommit objects.
Class Method Details
.parse(log_s) ⇒ Object
Returns a list of GitCommit objects.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/wlog/tech/git_commit_parser.rb', line 8 def self.parse(log_s) cur = nil = false gitlogs = [] log_s.lines.each do |line| case line when /^commit/i = false gitlogs.push cur if cur cur = GitCommit.new cur.commit = line.split[1].strip when /^author/i next unless cur cur. = line.split[1].strip when /^date/i, /^\n$/ next else next unless cur if cur..concat(line) cur..strip! else cur.shortlog = line cur.shortlog.strip! = true end end end # if commits have no hash, discard them gitlogs.reject! { |e| e.commit == "" } gitlogs.push cur if cur gitlogs end |