Module: Gitlab::Config::Entry::Configurable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Gitlab::Ci::Config::Entry::Artifacts, Gitlab::Ci::Config::Entry::Cache, Gitlab::Ci::Config::Entry::Default, Gitlab::Ci::Config::Entry::Environment, Gitlab::Ci::Config::Entry::Hooks, Gitlab::Ci::Config::Entry::Imageable, Gitlab::Ci::Config::Entry::Include, Gitlab::Ci::Config::Entry::Include::Rules::Rule, Gitlab::Ci::Config::Entry::Inherit, Gitlab::Ci::Config::Entry::Key::ComplexKey, Gitlab::Ci::Config::Entry::Need::JobHash, Gitlab::Ci::Config::Entry::Processable, Gitlab::Ci::Config::Entry::Product::Parallel::MatrixBuilds, Gitlab::Ci::Config::Entry::Release, Gitlab::Ci::Config::Entry::Release::Assets, Gitlab::Ci::Config::Entry::Release::Assets::Links, Gitlab::Ci::Config::Entry::Reports, Gitlab::Ci::Config::Entry::Root, Gitlab::Ci::Config::Entry::Rules::Rule, Gitlab::Ci::Config::Entry::Trigger::ComplexTrigger::CrossProjectTrigger, Gitlab::Ci::Config::Entry::Trigger::ComplexTrigger::SameProjectTrigger, Gitlab::Ci::Config::Entry::Workflow, Gitlab::Ci::Config::Header::Root, Gitlab::Ci::Config::Header::Spec, WebIde::Config::Entry::Global, WebIde::Config::Entry::Terminal
- Defined in:
- lib/gitlab/config/entry/configurable.rb
Overview
This mixin is responsible for adding DSL, which purpose is to simplify the process of adding child nodes.
This can be used only if parent node is a configuration entry that holds a hash as a configuration value, for example:
job:
script: ...
artifacts: ...
Instance Method Summary collapse
- #compose!(deps = nil) ⇒ Object
-
#entry_create!(key, value) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
-
#skip_config_hash_validation? ⇒ Boolean
rubocop: enable CodeReuse/ActiveRecord.
Instance Method Details
#compose!(deps = nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gitlab/config/entry/configurable.rb', line 28 def compose!(deps = nil) return unless valid? super do self.class.nodes.each do |key, factory| # If we override the config type validation # we can end with different config types like String next unless config.is_a?(Hash) entry_create!(key, config[key]) end yield if block_given? entries.each_value do |entry| entry.compose!(deps) end end end |
#entry_create!(key, value) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
49 50 51 52 53 54 55 56 |
# File 'lib/gitlab/config/entry/configurable.rb', line 49 def entry_create!(key, value) factory = self.class .nodes[key] .value(value) .with(key: key, parent: self) entries[key] = factory.create! end |
#skip_config_hash_validation? ⇒ Boolean
rubocop: enable CodeReuse/ActiveRecord
59 60 61 |
# File 'lib/gitlab/config/entry/configurable.rb', line 59 def skip_config_hash_validation? false end |