Class: CommitChangelog
- Inherits:
-
Object
- Object
- CommitChangelog
- Defined in:
- lib/commit_changelog.rb
Overview
Filters commit messages for changelog entries.
Instance Attribute Summary collapse
-
#changelog ⇒ Object
readonly
Contains changelog entries of the commits.
Instance Method Summary collapse
-
#add_commit(commit) ⇒ Object
Adds changelog information contained in a specific commit message.
-
#initialize(to_commit, from_commit) ⇒ Array
constructor
Instantiates an object containing changelog entries between two git commits.
Constructor Details
#initialize(to_commit, from_commit) ⇒ Array
Instantiates an object containing changelog entries between two git commits.
34 35 36 37 38 39 |
# File 'lib/commit_changelog.rb', line 34 def initialize(to_commit, from_commit) pattern = ChangelogFilter.pattern = Git.(from_commit, to_commit, pattern) filter = ChangelogFilter.FromString() @changelog = filter.changelog end |
Instance Attribute Details
#changelog ⇒ Object (readonly)
Contains changelog entries of the commits.
20 21 22 |
# File 'lib/commit_changelog.rb', line 20 def changelog @changelog end |
Instance Method Details
#add_commit(commit) ⇒ Object
Adds changelog information contained in a specific commit message. This method is typically used to parse the initial commit’s commit message.
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/commit_changelog.rb', line 50 def add_commit(commit) pattern = ChangelogFilter.pattern filtered_text = Git.(commit, pattern) if filtered_text filtered_lines = filtered_text.split("\n").uniq if @changelog @changelog = @changelog.concat(filtered_lines).uniq else @changelog = filtered_lines end end end |