Class: Gitlab::Template::Finders::BaseTemplateFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/template/finders/base_template_finder.rb

Direct Known Subclasses

GlobalTemplateFinder, RepoTemplateFinder

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_dir) ⇒ BaseTemplateFinder

Returns a new instance of BaseTemplateFinder.


7
8
9
# File 'lib/gitlab/template/finders/base_template_finder.rb', line 7

def initialize(base_dir)
  @base_dir = base_dir
end

Class Method Details

.filter_regex(extension) ⇒ Object


30
31
32
# File 'lib/gitlab/template/finders/base_template_finder.rb', line 30

def filter_regex(extension)
  /#{Regexp.escape(extension)}\z/
end

Instance Method Details

#category_directory(category) ⇒ Object


23
24
25
26
27
# File 'lib/gitlab/template/finders/base_template_finder.rb', line 23

def category_directory(category)
  return @base_dir unless category.present?

  File.join(@base_dir, @categories[category])
end

#findObject

Raises:

  • (NotImplementedError)

19
20
21
# File 'lib/gitlab/template/finders/base_template_finder.rb', line 19

def find
  raise NotImplementedError
end

#list_files_forObject

Raises:

  • (NotImplementedError)

11
12
13
# File 'lib/gitlab/template/finders/base_template_finder.rb', line 11

def list_files_for
  raise NotImplementedError
end

#readObject

Raises:

  • (NotImplementedError)

15
16
17
# File 'lib/gitlab/template/finders/base_template_finder.rb', line 15

def read
  raise NotImplementedError
end