summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config/node/entry.rb
blob: 6336535bc03577c099a21f36801ce5044c642214 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module Gitlab
  module Ci
    class Config
      module Node
        class Entry
          attr_reader :hash, :config, :parent, :nodes, :errors

          def initialize(hash, config, parent = nil)
            @hash = hash
            @config = config
            @parent = parent
            @nodes = {}
            @errors = []
          end

          def process!
            keys.each_pair do |key, entry|
              next unless hash.include?(key)
              @nodes[key] = entry.new(hash[key], config, self)
            end

            @nodes.values.each(&:process!)
            @nodes.values.each(&:validate!)
          end

          def keys
            raise NotImplementedError
          end

          def validate!
            raise NotImplementedError
          end
        end
      end
    end
  end
end