Class: Gitlab::Ci::Build::Context::Base
- Inherits:
-
Object
- Object
- Gitlab::Ci::Build::Context::Base
show all
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/build/context/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#clear_memoization, #strong_memoize, #strong_memoized?
Constructor Details
#initialize(pipeline) ⇒ Base
Returns a new instance of Base.
12
13
14
|
# File 'lib/gitlab/ci/build/context/base.rb', line 12
def initialize(pipeline)
@pipeline = pipeline
end
|
Instance Attribute Details
#pipeline ⇒ Object
Returns the value of attribute pipeline.
10
11
12
|
# File 'lib/gitlab/ci/build/context/base.rb', line 10
def pipeline
@pipeline
end
|
Instance Method Details
#all_worktree_paths ⇒ Object
40
41
42
43
44
|
# File 'lib/gitlab/ci/build/context/base.rb', line 40
def all_worktree_paths
strong_memoize(:all_worktree_paths) do
project.repository.ls_files(sha)
end
end
|
#project ⇒ Object
26
27
28
|
# File 'lib/gitlab/ci/build/context/base.rb', line 26
def project
pipeline.project
end
|
#sha ⇒ Object
30
31
32
|
# File 'lib/gitlab/ci/build/context/base.rb', line 30
def sha
pipeline.sha
end
|
#top_level_worktree_paths ⇒ Object
34
35
36
37
38
|
# File 'lib/gitlab/ci/build/context/base.rb', line 34
def top_level_worktree_paths
strong_memoize(:top_level_worktree_paths) do
project.repository.tree(sha).blobs.map(&:path)
end
end
|
#variables ⇒ Object
16
17
18
|
# File 'lib/gitlab/ci/build/context/base.rb', line 16
def variables
raise NotImplementedError
end
|
#variables_hash ⇒ Object
20
21
22
23
24
|
# File 'lib/gitlab/ci/build/context/base.rb', line 20
def variables_hash
strong_memoize(:variables_hash) do
variables.to_hash
end
end
|