From fa64da65e7205b101569a3e515a0a65ae2d679c9 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Tue, 7 Mar 2017 21:35:15 +0900 Subject: Use 'case/when/end' --- app/finders/pipelines_finder.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'app/finders') diff --git a/app/finders/pipelines_finder.rb b/app/finders/pipelines_finder.rb index 93f1ab9598f..46588cf3c16 100644 --- a/app/finders/pipelines_finder.rb +++ b/app/finders/pipelines_finder.rb @@ -88,13 +88,11 @@ class PipelinesFinder end def by_yaml_errors(items) - flg = Gitlab::Utils.to_boolean(params[:yaml_errors]) - if !flg.nil? - if flg - items.where("yaml_errors IS NOT NULL") - else - items.where("yaml_errors IS NULL") - end + case Gitlab::Utils.to_boolean(params[:yaml_errors]) + when true + items.where("yaml_errors IS NOT NULL") + when false + items.where("yaml_errors IS NULL") else items end -- cgit v1.2.1