Class: Gitlab::Ci::RefFinder
- Inherits:
-
Object
- Object
- Gitlab::Ci::RefFinder
- Defined in:
- lib/gitlab/ci/ref_finder.rb
Instance Method Summary collapse
- #find_by_sha(sha) ⇒ Object
-
#initialize(project) ⇒ RefFinder
constructor
A new instance of RefFinder.
Constructor Details
#initialize(project) ⇒ RefFinder
Returns a new instance of RefFinder.
6 7 8 |
# File 'lib/gitlab/ci/ref_finder.rb', line 6 def initialize(project) @project = project end |
Instance Method Details
#find_by_sha(sha) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/gitlab/ci/ref_finder.rb', line 10 def find_by_sha(sha) return unless project Rails.cache.fetch(['project', project.id, 'ref/containing/sha', sha], expires_in: 5.minutes) do break unless project_sha_exists?(sha) project_sha_branch_name(sha) || project_sha_tag_name(sha) end end |