create class and implement encapsulation. This fix #34

This commit is contained in:
Petr Korolev
2014-12-03 15:38:05 +02:00
parent f1d9c839c7
commit 057fb488d5
2 changed files with 27 additions and 12 deletions
@@ -0,0 +1,20 @@
module GitHubChangelogGenerator
class Generator
def initialize(options)
@options = options
end
def get_string_for_pull_request(pull_request)
trimmed_title = pull_request[:title].gsub '>', '/>'
merge = "#{@options[:merge_prefix]}#{trimmed_title} [\\##{pull_request[:number]}](#{pull_request.html_url})"
if @options[:author]
merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
else
merge += "\n\n"
end
merge
end
end
end