Class: PimpMyChangelog::Pimper
- Inherits:
-
Object
- Object
- PimpMyChangelog::Pimper
- Defined in:
- lib/pimpmychangelog/pimper.rb
Constant Summary collapse
- SEPARATOR =
"<!--- The following link definition list is generated by PimpMyChangelog --->"
Instance Attribute Summary collapse
-
#changelog ⇒ Object
readonly
Returns the value of attribute changelog.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#better_changelog ⇒ String
The changelog with contributors and issues as link.
-
#initialize(user, project, changelog) ⇒ Pimper
constructor
A new instance of Pimper.
Constructor Details
#initialize(user, project, changelog) ⇒ Pimper
Returns a new instance of Pimper.
11 12 13 14 15 |
# File 'lib/pimpmychangelog/pimper.rb', line 11 def initialize(user, project, changelog) @user = user @project = project @changelog = changelog end |
Instance Attribute Details
#changelog ⇒ Object (readonly)
Returns the value of attribute changelog.
6 7 8 |
# File 'lib/pimpmychangelog/pimper.rb', line 6 def changelog @changelog end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
6 7 8 |
# File 'lib/pimpmychangelog/pimper.rb', line 6 def project @project end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/pimpmychangelog/pimper.rb', line 6 def user @user end |
Instance Method Details
#better_changelog ⇒ String
Returns The changelog with contributors and issues as link.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pimpmychangelog/pimper.rb', line 18 def better_changelog parsed_changelog = Parser.new(changelog) # If the file doesn't have an extra newline at the end the separator gets rendered # as part of the changelog. So add an extra newline in that case. extra_newline_if_required = parsed_changelog.content.match(/\n\n\Z/) ? "" : "\n" linkify_changelog(parsed_changelog.content) + extra_newline_if_required + links_definitions(parsed_changelog.issues, parsed_changelog.contributors) end |