diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 12:07:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 12:07:52 +0000 |
commit | c6c7437861bff9572747674095c4dfbdfbea4988 (patch) | |
tree | 237d1ed922193f19ae326923457344c082003788 /lib/gitlab/config | |
parent | d80f3cd75e700b6e62910865bfd36734644ffa89 (diff) | |
download | gitlab-ce-c6c7437861bff9572747674095c4dfbdfbea4988.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/config')
-rw-r--r-- | lib/gitlab/config/entry/configurable.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/config/entry/configurable.rb b/lib/gitlab/config/entry/configurable.rb index 75e15cd8cb1..3fd562c2904 100644 --- a/lib/gitlab/config/entry/configurable.rb +++ b/lib/gitlab/config/entry/configurable.rb @@ -75,7 +75,8 @@ module Gitlab # rubocop: disable CodeReuse/ActiveRecord def entry(key, entry, description: nil, default: nil, inherit: nil, reserved: nil, metadata: {}) - raise ArgumentError, "Entry #{key} already defined" if @nodes.to_h[key.to_sym] + entry_name = key.to_sym + raise ArgumentError, "Entry #{key} already defined" if @nodes.to_h[entry_name] factory = ::Gitlab::Config::Entry::Factory.new(entry) .with(description: description) @@ -84,10 +85,17 @@ module Gitlab .with(reserved: reserved) .metadata(metadata) - (@nodes ||= {}).merge!(key.to_sym => factory) + @nodes ||= {} + @nodes[entry_name] = factory + + helpers(entry_name) end # rubocop: enable CodeReuse/ActiveRecord + def dynamic_helpers(*nodes) + helpers(*nodes, dynamic: true) + end + def helpers(*nodes, dynamic: false) nodes.each do |symbol| if method_defined?("#{symbol}_defined?") || method_defined?("#{symbol}_value") |