summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2018-09-25 10:07:59 -0700
committerMichael Kozono <mkozono@gmail.com>2018-09-27 15:16:09 -0700
commitd9c4ebc5a0b2e911f17865e482de1dfcc2189ac3 (patch)
tree17da1018b4eabbc858f33568e03cf944b946331c /app/models/repository.rb
parent0920342094ae07d7225b42cf23cf9637076d2b25 (diff)
downloadgitlab-ce-d9c4ebc5a0b2e911f17865e482de1dfcc2189ac3.tar.gz
Extract `Repository.memoize_method` method
And reuse `Gitlab::Utils::StrongMemoize`. There is a subtle behavior change required to reuse StrongMemoize in this case. The early fallback check now occurs *before* reading the memoized value instead of after. I think this is fine since a memoized value should only exist if `exists?` is also already memoized as `true`.
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 12fbf7d5d1d..7a6dfada917 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -612,7 +612,7 @@ class Repository
Licensee::License.new(license_key)
end
- cache_method :license, memoize_only: true
+ memoize_method :license
def gitignore
file_on_head(:gitignore)