Module: Ci::HasRef

Extended by:
ActiveSupport::Concern
Included in:
Bridge, Build, Pipeline
Defined in:
app/models/concerns/ci/has_ref.rb

Instance Method Summary collapse

Instance Method Details

#branch?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/models/concerns/ci/has_ref.rb', line 10

def branch?
  !tag? && !merge_request?
end

#git_refObject



14
15
16
17
18
19
20
# File 'app/models/concerns/ci/has_ref.rb', line 14

def git_ref
  if branch?
    Gitlab::Git::BRANCH_REF_PREFIX + ref.to_s
  elsif tag?
    Gitlab::Git::TAG_REF_PREFIX + ref.to_s
  end
end

#ref_slugObject

A slugified version of the build ref, suitable for inclusion in URLs and domain names. Rules:

* Lowercased
* Anything not matching [a-z0-9-] is replaced with a -
* Maximum length is 63 bytes
* First/Last Character is not a hyphen


29
30
31
# File 'app/models/concerns/ci/has_ref.rb', line 29

def ref_slug
  Gitlab::Utils.slugify(ref.to_s)
end