Class: Gitlab::Config::Entry::ComposableHash
- Includes:
- Validatable
- Defined in:
- lib/gitlab/config/entry/composable_hash.rb
Overview
Entry that represents a composable hash definition Where each hash key can be any value written by the user
Direct Known Subclasses
Gitlab::Ci::Config::Entry::Jobs, Gitlab::Ci::Config::Entry::Variables
Constant Summary
Constants inherited from Node
Instance Attribute Summary
Attributes inherited from Node
#config, #default, #deprecation, #description, #key, #metadata, #parent
Instance Method Summary collapse
Methods included from Validatable
#errors, included, #validate, #validator
Methods inherited from Node
#[], #add_warning, #ancestors, #array?, aspects, default, #descendants, #errors, #hash?, #initialize, #inspect, #integer?, #leaf?, #location, #opt, #relevant?, #specified?, #string?, #valid?, #value, #warnings, with_aspect
Constructor Details
This class inherits a constructor from Gitlab::Config::Entry::Node
Instance Method Details
#compose!(deps = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gitlab/config/entry/composable_hash.rb', line 19 def compose!(deps = nil) super do @config.each do |name, config| entry_class = composable_class(name, config) raise ArgumentError, 'Missing Composable class' unless entry_class entry_class_name = entry_class.name.demodulize.underscore factory = ::Gitlab::Config::Entry::Factory.new(entry_class) .value(config.nil? ? {} : config) .with(key: name, parent: self, description: "#{name} #{entry_class_name} definition") # rubocop:disable CodeReuse/ActiveRecord .(.merge(name: name)) @entries[name] = factory.create! end @entries.each_value do |entry| entry.compose!(deps) end end end |