summaryrefslogtreecommitdiff
path: root/lib/extracts_path.rb
diff options
context:
space:
mode:
authorgfyoung <gfyoung17@gmail.com>2018-10-06 16:10:08 -0700
committergfyoung <gfyoung17@gmail.com>2018-10-06 17:02:50 -0700
commitd598e4fd937797a7f7778f5b4158ebf73139ce7f (patch)
treeaaf16bddfbd7b9aeba06b15e893c474b4f125506 /lib/extracts_path.rb
parentc3389c8006443e2b4d994eb15e60bd249fc4732f (diff)
downloadgitlab-ce-d598e4fd937797a7f7778f5b4158ebf73139ce7f.tar.gz
Enable more frozen string in lib/**/*.rb
Enables frozen for the following: * lib/*.rb * lib/banzai/**/*.rb * lib/bitbucket/**/*.rb * lib/constraints/**/*.rb * lib/container_registry/**/*.rb * lib/declarative_policy/**/*.rb Partially addresses #47424.
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r--lib/extracts_path.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index e02d403f7b1..a340a276640 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# Module providing methods for dealing with separating a tree-ish string and a
# file path string when combined in a request parameter
module ExtractsPath
@@ -50,7 +52,9 @@ module ExtractsPath
# branches and tags
# Append a trailing slash if we only get a ref and no file path
- id += '/' unless id.ends_with?('/')
+ unless id.ends_with?('/')
+ id = [id, '/'].join
+ end
valid_refs = ref_names.select { |v| id.start_with?("#{v}/") }
@@ -151,9 +155,9 @@ module ExtractsPath
# overriden in subclasses, do not remove
def get_id
- id = params[:id] || params[:ref]
- id += "/" + params[:path] unless params[:path].blank?
- id
+ id = [params[:id] || params[:ref]]
+ id << "/" + params[:path] unless params[:path].blank?
+ id.join
end
def ref_names