Class: Gitlab::Ci::Config::External::File::Template

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/ci/config/external/file/template.rb

Constant Summary collapse

SUFFIX =
'.gitlab-ci.yml'
HOST =
'https://gitlab.com/gitlab-org/gitlab/-/raw/master'

Constants inherited from Base

Base::YAML_WHITELIST_EXTENSION

Instance Attribute Summary collapse

Attributes inherited from Base

#context, #errors, #params

Instance Method Summary collapse

Methods inherited from Base

#eql?, #error_message, #hash, #invalid_extension?, #invalid_location_type?, #matching?, #to_hash, #valid?, #validate!

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(params, context) ⇒ Template

Returns a new instance of Template.


14
15
16
17
18
# File 'lib/gitlab/ci/config/external/file/template.rb', line 14

def initialize(params, context)
  @location = params[:template]

  super
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.


9
10
11
# File 'lib/gitlab/ci/config/external/file/template.rb', line 9

def location
  @location
end

Instance Method Details

#contentObject


20
21
22
# File 'lib/gitlab/ci/config/external/file/template.rb', line 20

def content
  strong_memoize(:content) { fetch_template_content }
end

#metadataObject


24
25
26
27
28
29
30
31
32
# File 'lib/gitlab/ci/config/external/file/template.rb', line 24

def 
  super.merge(
    type: :template,
    location: masked_location,
    blob: nil,
    raw: masked_raw,
    extra: {}
  )
end