summaryrefslogtreecommitdiff
path: root/lib/gitlab/config/entry/factory.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/config/entry/factory.rb')
-rw-r--r--lib/gitlab/config/entry/factory.rb20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/gitlab/config/entry/factory.rb b/lib/gitlab/config/entry/factory.rb
index 8f1f4a81bb5..7c5ffaa7621 100644
--- a/lib/gitlab/config/entry/factory.rb
+++ b/lib/gitlab/config/entry/factory.rb
@@ -9,10 +9,12 @@ module Gitlab
class Factory
InvalidFactory = Class.new(StandardError)
- def initialize(entry)
- @entry = entry
+ attr_reader :entry_class
+
+ def initialize(entry_class)
+ @entry_class = entry_class
@metadata = {}
- @attributes = { default: entry.default }
+ @attributes = { default: entry_class.default }
end
def value(value)
@@ -34,6 +36,10 @@ module Gitlab
@attributes[:description]
end
+ def inherit
+ @attributes[:inherit]
+ end
+
def inheritable?
@attributes[:inherit]
end
@@ -52,7 +58,7 @@ module Gitlab
if @value.nil?
Entry::Unspecified.new(fabricate_unspecified)
else
- fabricate(@entry, @value)
+ fabricate(entry_class, @value)
end
end
@@ -68,12 +74,12 @@ module Gitlab
if default.nil?
fabricate(Entry::Undefined)
else
- fabricate(@entry, default)
+ fabricate(entry_class, default)
end
end
- def fabricate(entry, value = nil)
- entry.new(value, @metadata) do |node|
+ def fabricate(entry_class, value = nil)
+ entry_class.new(value, @metadata) do |node|
node.key = @attributes[:key]
node.parent = @attributes[:parent]
node.default = @attributes[:default]