From 7e2846fb57ef24dfac0de57f7b086a7415cc44e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vanja=20Radovanovi=C4=87?= Date: Mon, 10 Sep 2012 17:32:31 +0200 Subject: [PATCH] using blank?, much shorter --- app/decorators/commit_decorator.rb | 2 +- app/helpers/gitlab_markdown_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/decorators/commit_decorator.rb b/app/decorators/commit_decorator.rb index 56067221..c85f7400 100644 --- a/app/decorators/commit_decorator.rb +++ b/app/decorators/commit_decorator.rb @@ -16,7 +16,7 @@ class CommitDecorator < ApplicationDecorator # In case this first line is longer than 80 characters, it is cut off # after 70 characters and ellipses (`&hellp;`) are appended. def title - return no_commit_message unless safe_message && !safe_message.strip.empty? + return no_commit_message if safe_message.blank? title_end = safe_message.index(/\n/) if (!title_end && safe_message.length > 80) || (title_end && title_end > 80) diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index a54d2e3b..511d4628 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -11,7 +11,7 @@ module GitlabMarkdownHelper # explicitly produce the correct linking behavior (i.e. # "outer text gfm ref more outer text"). def link_to_gfm(body, url, html_options = {}) - return "" unless body && !body.strip.empty? + return "" if body.blank? gfm_body = gfm(body, html_options)