Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexis Reigel <alexis.reigel.ext@siemens.com>2018-09-12 21:14:49 +0300
committerAlexis Reigel <alexis.reigel.ext@siemens.com>2018-09-12 21:14:49 +0300
commitb4e2cc4421c8a836ae26867ac3eec35be079590a (patch)
tree93c51bc1e3ab535d602a7b0f117714ba46f7b34a /lib
parent03890558b47f1bad215807c1ce84cb99043aa01e (diff)
replace cond. assignment by default param value
Diffstat (limited to 'lib')
-rw-r--r--lib/api/runners.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/api/runners.rb b/lib/api/runners.rb
index 3ddf6694e57..fad7f5f0483 100644
--- a/lib/api/runners.rb
+++ b/lib/api/runners.rb
@@ -14,7 +14,7 @@ module API
use :pagination
end
get do
- runners = filter_runners(current_user.ci_owned_runners, params[:scope], only: Ci::Runner::AVAILABLE_STATUSES)
+ runners = filter_runners(current_user.ci_owned_runners, params[:scope], allowed_scopes: Ci::Runner::AVAILABLE_STATUSES)
present paginate(runners), with: Entities::Runner
end
@@ -158,12 +158,10 @@ module API
end
helpers do
- def filter_runners(runners, scope, only: nil)
+ def filter_runners(runners, scope, allowed_scopes: ::Ci::Runner::AVAILABLE_SCOPES)
return runners unless scope.present?
- available_scopes = only || ::Ci::Runner::AVAILABLE_SCOPES
-
- unless available_scopes.include?(scope)
+ unless allowed_scopes.include?(scope)
render_api_error!('Scope contains invalid value', 400)
end