Class: Gitlab::Ci::Config::Entry::Ports

Inherits:
Gitlab::Config::Entry::Node show all
Includes:
Gitlab::Config::Entry::Validatable
Defined in:
lib/gitlab/ci/config/entry/ports.rb

Overview

Entry that represents a configuration of the ports of a Docker service.

Constant Summary

Constants inherited from Gitlab::Config::Entry::Node

Gitlab::Config::Entry::Node::InvalidError

Instance Attribute Summary

Attributes inherited from Gitlab::Config::Entry::Node

#config, #default, #description, #key, #metadata, #parent

Instance Method Summary collapse

Methods included from Gitlab::Config::Entry::Validatable

#errors, included, #validate, #validator

Methods inherited from Gitlab::Config::Entry::Node

#[], #add_warning, #ancestors, aspects, default, #errors, #hash?, #initialize, #inspect, #integer?, #leaf?, #location, #opt, #relevant?, #specified?, #string?, #valid?, #warnings, with_aspect

Constructor Details

This class inherits a constructor from Gitlab::Config::Entry::Node

Instance Method Details

#compose!(deps = nil) ⇒ Object


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/gitlab/ci/config/entry/ports.rb', line 19

def compose!(deps = nil)
  super do
    @entries = []
    @config.each do |config|
      @entries << ::Gitlab::Config::Entry::Factory.new(Entry::Port)
        .value(config || {})
        .with(key: "port", parent: self, description: "port definition.") # rubocop:disable CodeReuse/ActiveRecord
        .create!
    end

    @entries.each do |entry|
      entry.compose!(deps)
    end
  end
end

#descendantsObject


39
40
41
# File 'lib/gitlab/ci/config/entry/ports.rb', line 39

def descendants
  @entries
end

#valueObject


35
36
37
# File 'lib/gitlab/ci/config/entry/ports.rb', line 35

def value
  @entries.map(&:value)
end