Use guard clause instead of if-else statement

This commit is contained in:
Airat Shigapov 2016-10-12 09:51:02 +03:00
parent 32cf2e5f77
commit 7b90680c2d
No known key found for this signature in database
GPG Key ID: 95B04300D2844C47
1 changed files with 12 additions and 13 deletions

View File

@ -128,22 +128,21 @@ class HipchatService < Service
end
def markdown(text, options = {})
if text
context = {
project: project,
pipeline: :email
}
return "" unless text
Banzai.render(text, context)
context = {
project: project,
pipeline: :email
}
context.merge!(options)
Banzai.render(text, context)
html = Banzai.render(text, context)
html = Banzai.post_process(html, context)
sanitize html, attributes: %w(href title alt)
else
""
end
context.merge!(options)
html = Banzai.render(text, context)
html = Banzai.post_process(html, context)
sanitize html, attributes: %w(href title alt)
end
def create_issue_message(data)