Class: ExtractsRef::RequestedRef
- Inherits:
-
Object
- Object
- ExtractsRef::RequestedRef
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- lib/extracts_ref/requested_ref.rb
Constant Summary collapse
- SYMBOLIC_REF_PREFIX =
%r{((refs/)?(heads|tags)/)+}
Instance Attribute Summary collapse
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#ref_type ⇒ Object
readonly
Returns the value of attribute ref_type.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(repository, ref_type:, ref:) ⇒ RequestedRef
constructor
A new instance of RequestedRef.
Constructor Details
#initialize(repository, ref_type:, ref:) ⇒ RequestedRef
Returns a new instance of RequestedRef.
8 9 10 11 12 |
# File 'lib/extracts_ref/requested_ref.rb', line 8 def initialize(repository, ref_type:, ref:) @ref_type = ref_type @ref = ref @repository = repository end |
Instance Attribute Details
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
14 15 16 |
# File 'lib/extracts_ref/requested_ref.rb', line 14 def ref @ref end |
#ref_type ⇒ Object (readonly)
Returns the value of attribute ref_type.
14 15 16 |
# File 'lib/extracts_ref/requested_ref.rb', line 14 def ref_type @ref_type end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
14 15 16 |
# File 'lib/extracts_ref/requested_ref.rb', line 14 def repository @repository end |
Instance Method Details
#find ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/extracts_ref/requested_ref.rb', line 16 def find case ref_type when 'tags' { ref_type: ref_type, commit: tag } when 'heads' { ref_type: ref_type, commit: branch } else commit_without_ref_type end end |