Class: Gitlab::Git::Branch
Constant Summary collapse
- STALE_BRANCH_THRESHOLD =
3.months
Constants included from EncodingHelper
EncodingHelper::ENCODING_CONFIDENCE_THRESHOLD
Instance Attribute Summary
Attributes inherited from Ref
#dereferenced_target, #name, #target
Class Method Summary collapse
Instance Method Summary collapse
- #active? ⇒ Boolean
-
#initialize(repository, name, target, target_commit) ⇒ Branch
constructor
A new instance of Branch.
- #stale? ⇒ Boolean
- #state ⇒ Object
Methods inherited from Ref
Methods included from RuggedImpl::Ref
Methods included from EncodingHelper
#binary_io, #detect_binary?, #detect_libgit2_binary?, #encode!, #encode_binary, #encode_utf8
Constructor Details
#initialize(repository, name, target, target_commit) ⇒ Branch
Returns a new instance of Branch.
16 17 18 |
# File 'lib/gitlab/git/branch.rb', line 16 def initialize(repository, name, target, target_commit) super(repository, name, target, target_commit) end |
Class Method Details
Instance Method Details
#active? ⇒ Boolean
20 21 22 |
# File 'lib/gitlab/git/branch.rb', line 20 def active? self.dereferenced_target.committed_date >= STALE_BRANCH_THRESHOLD.ago end |
#stale? ⇒ Boolean
24 25 26 |
# File 'lib/gitlab/git/branch.rb', line 24 def stale? !active? end |
#state ⇒ Object
28 29 30 |
# File 'lib/gitlab/git/branch.rb', line 28 def state active? ? :active : :stale end |