Class: Gitlab::Ci::Config::Entry::Product::Matrix
- Inherits:
-
Gitlab::Config::Entry::Node
- Object
- Gitlab::Config::Entry::Node
- Gitlab::Ci::Config::Entry::Product::Matrix
- Includes:
- Gitlab::Config::Entry::Attributable, Gitlab::Config::Entry::Validatable, Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/config/entry/product/matrix.rb
Constant Summary
Constants inherited from Gitlab::Config::Entry::Node
Gitlab::Config::Entry::Node::InvalidError
Instance Attribute Summary
Attributes inherited from Gitlab::Config::Entry::Node
#config, #default, #deprecation, #description, #key, #metadata, #parent
Instance Method Summary collapse
Methods included from Gitlab::Config::Entry::Validatable
#errors, included, #validate, #validator
Methods included from Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods inherited from Gitlab::Config::Entry::Node
#[], #add_warning, #ancestors, aspects, default, #descendants, #errors, #hash?, #initialize, #inspect, #integer?, #leaf?, #location, #opt, #relevant?, #specified?, #string?, #valid?, #warnings, with_aspect
Constructor Details
This class inherits a constructor from Gitlab::Config::Entry::Node
Instance Method Details
#compose!(deps = nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gitlab/ci/config/entry/product/matrix.rb', line 28 def compose!(deps = nil) super(deps) do @config.each_with_index do |variables, index| @entries[index] = ::Gitlab::Config::Entry::Factory.new(Entry::Product::Variables) .value(variables) .with(parent: self, description: 'matrix variables definition.') # rubocop:disable CodeReuse/ActiveRecord .create! end @entries.each_value do |entry| entry.compose!(deps) end end end |
#number_of_generated_jobs ⇒ Object
49 50 51 52 53 |
# File 'lib/gitlab/ci/config/entry/product/matrix.rb', line 49 def number_of_generated_jobs value.sum do |config| config.values.reduce(1) { |acc, values| acc * values.size } end end |
#value ⇒ Object
43 44 45 46 47 |
# File 'lib/gitlab/ci/config/entry/product/matrix.rb', line 43 def value strong_memoize(:value) do @entries.values.map(&:value) end end |