Class: Gitlab::Git::Finders::RefsFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/git/finders/refs_finder.rb

Constant Summary collapse

UnknownRefTypeError =
Class.new(StandardError)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository, search:, ref_type:) ⇒ RefsFinder

Returns a new instance of RefsFinder.



11
12
13
14
15
# File 'lib/gitlab/git/finders/refs_finder.rb', line 11

def initialize(repository, search:, ref_type:)
  @repository = repository
  @search = search
  @ref_type = ref_type
end

Instance Attribute Details

#ref_typeObject (readonly)

Returns the value of attribute ref_type.



7
8
9
# File 'lib/gitlab/git/finders/refs_finder.rb', line 7

def ref_type
  @ref_type
end

#repositoryObject (readonly)

Returns the value of attribute repository.



7
8
9
# File 'lib/gitlab/git/finders/refs_finder.rb', line 7

def repository
  @repository
end

#searchObject (readonly)

Returns the value of attribute search.



7
8
9
# File 'lib/gitlab/git/finders/refs_finder.rb', line 7

def search
  @search
end

Instance Method Details

#executeObject



17
18
19
20
21
22
23
# File 'lib/gitlab/git/finders/refs_finder.rb', line 17

def execute
  pattern = [prefix, search, "*"].compact.join

  repository.list_refs(
    [pattern]
  )
end