From d598e4fd937797a7f7778f5b4158ebf73139ce7f Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sat, 6 Oct 2018 16:10:08 -0700 Subject: 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. --- lib/extracts_path.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/extracts_path.rb') 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 -- cgit v1.2.3