summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config/node/entry.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/config/node/entry.rb')
-rw-r--r--lib/gitlab/ci/config/node/entry.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/gitlab/ci/config/node/entry.rb b/lib/gitlab/ci/config/node/entry.rb
index 007585d4019..af92899af40 100644
--- a/lib/gitlab/ci/config/node/entry.rb
+++ b/lib/gitlab/ci/config/node/entry.rb
@@ -5,22 +5,28 @@ module Gitlab
class Entry
include Config::ValidationHelpers
- attr_reader :value, :parent
+ attr_reader :value, :nodes, :parent
def initialize(value, config, parent = nil)
@value = value
@config = config
@parent = parent
- @nodes = {}
- @errors = []
+ @nodes, @errors = [], []
+
+ keys.each_key do |key|
+ instance_variable_set("@#{key}", Null.new(nil, config, self))
+ end
end
def process!
return if leaf?
- keys.each_pair do |key, entry|
- next unless @value.include?(key)
- @nodes[key] = entry.new(@value[key], @config, self)
+ keys.each do |key, entry_class|
+ next unless @value.has_key?(key)
+
+ entry = entry_class.new(@value[key], @config, self)
+ instance_variable_set("@#{key}", entry)
+ @nodes.append(entry)
end
nodes.each(&:process!)
@@ -31,10 +37,6 @@ module Gitlab
@errors + nodes.map(&:errors).flatten
end
- def nodes
- @nodes.values
- end
-
def valid?
errors.none?
end