Class: Gitlab::Ci::Pipeline::Seed::Build::Cache
- Inherits:
-
Object
- Object
- Gitlab::Ci::Pipeline::Seed::Build::Cache
- Defined in:
- lib/gitlab/ci/pipeline/seed/build/cache.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #build_attributes ⇒ Object
-
#initialize(pipeline, cache, custom_key_prefix) ⇒ Cache
constructor
A new instance of Cache.
Constructor Details
#initialize(pipeline, cache, custom_key_prefix) ⇒ Cache
Returns a new instance of Cache.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gitlab/ci/pipeline/seed/build/cache.rb', line 9 def initialize(pipeline, cache, custom_key_prefix) @pipeline = pipeline local_cache = cache.to_h.deep_dup @key = local_cache.delete(:key) @paths = local_cache.delete(:paths) @policy = local_cache.delete(:policy) @untracked = local_cache.delete(:untracked) @when = local_cache.delete(:when) @unprotect = local_cache.delete(:unprotect) @custom_key_prefix = custom_key_prefix @fallback_keys = local_cache.delete(:fallback_keys) raise ArgumentError, "unknown cache keys: #{local_cache.keys}" if local_cache.any? end |
Instance Method Details
#attributes ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/gitlab/ci/pipeline/seed/build/cache.rb', line 24 def attributes { key: key_string, paths: @paths, policy: @policy, untracked: @untracked, when: @when, unprotect: @unprotect, fallback_keys: @fallback_keys }.compact end |
#build_attributes ⇒ Object
36 37 38 |
# File 'lib/gitlab/ci/pipeline/seed/build/cache.rb', line 36 def build_attributes { options: { cache: attributes.presence }.compact } end |