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
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-11-17 15:27:16 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-11-17 20:01:53 +0300
commit9ac0c76b78cd04b2505924f003dd720a0f155959 (patch)
tree67af1f0be0b9d6b5fc42b27c5afe5516e2c7574c /lib/extracts_path.rb
parent0af35d7e30e373b885bfddb30b14718d72d75ab0 (diff)
Use StrongMemoize and enable/disable cops properly
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r--lib/extracts_path.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index 9e01eed06f3..40a65aad631 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -37,11 +37,10 @@ module ExtractsPath
#
# Returns an Array where the first value is the tree-ish and the second is the
# path
- # rubocop:disable Cop/ModuleWithInstanceVariables
def extract_ref(id)
pair = ['', '']
- return pair unless @project
+ return pair unless @project # rubocop:disable Cop/ModuleWithInstanceVariables
if id =~ /^(\h{40})(.+)/
# If the ref appears to be a SHA, we're done, just split the string
@@ -133,10 +132,10 @@ module ExtractsPath
rescue RuntimeError, NoMethodError, InvalidPathError
render_404
end
+ # rubocop:enable Cop/ModuleWithInstanceVariables
- # rubocop:disable Cop/ModuleWithInstanceVariables
def tree
- @tree ||= @repo.tree(@commit.id, @path)
+ @tree ||= @repo.tree(@commit.id, @path) # rubocop:disable Cop/ModuleWithInstanceVariables
end
private
@@ -148,10 +147,9 @@ module ExtractsPath
id
end
- # rubocop:disable Cop/ModuleWithInstanceVariables
def ref_names
- return [] unless @project
+ return [] unless @project # rubocop:disable Cop/ModuleWithInstanceVariables
- @ref_names ||= @project.repository.ref_names
+ @ref_names ||= @project.repository.ref_names # rubocop:disable Cop/ModuleWithInstanceVariables
end
end