Class: GitCommitLogParser
- Inherits:
-
Object
- Object
- GitCommitLogParser
- Defined in:
- lib/tddium/scm/git_log_parser.rb
Overview
this is not namespaced under Tddium because we want to eventually move this out into another gem
Instance Attribute Summary collapse
-
#commit_log ⇒ Object
Returns the value of attribute commit_log.
Instance Method Summary collapse
-
#commits ⇒ Object
Returns a list of commits in the following format [{ “id” => “15e8cbd88d68d210953d51c28e26c6b9944a313b”, “author” => Smith”, “email”=>“[email protected]”, “committer” => Smith”, “email”=>“[email protected]”, “summary” => “ignore .ruby-version for rvm”, “date” => 1380603292 }].
-
#initialize(commit_log) ⇒ GitCommitLogParser
constructor
15e8cbd88d68d210953d51c28e26c6b9944a313b ignore .ruby-version for rvm Bob Smith [email protected] 1367556311 Fred Smith [email protected] 1367556311.
Constructor Details
#initialize(commit_log) ⇒ GitCommitLogParser
15e8cbd88d68d210953d51c28e26c6b9944a313b
ignore .ruby-version for rvm
Bob Smith
[email protected]
1367556311
Fred Smith
[email protected]
1367556311
20 21 22 |
# File 'lib/tddium/scm/git_log_parser.rb', line 20 def initialize(commit_log) @commit_log = commit_log end |
Instance Attribute Details
#commit_log ⇒ Object
Returns the value of attribute commit_log.
5 6 7 |
# File 'lib/tddium/scm/git_log_parser.rb', line 5 def commit_log @commit_log end |
Instance Method Details
#commits ⇒ Object
Returns a list of commits in the following format [
"id" => "15e8cbd88d68d210953d51c28e26c6b9944a313b",
"author" => {"name"=>"Bob Smith", "email"=>"[email protected]",
"committer" => Smith", "email"=>"[email protected]",
"summary" => "ignore .ruby-version for rvm",
"date" => 1380603292
}]
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/tddium/scm/git_log_parser.rb', line 33 def commits record = [] commits = [] commit_log.lines.each do |line| line.strip! line.sanitize! if line.empty? c = parse_commit(record) commits.push(c) record = [] else record.push(line) end end commits end |