Class: Gitlab::Ci::Config::Entry::Variable::ComplexVariable

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

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, #deprecation, #description, #key, #metadata, #parent

Class Method Summary collapse

Instance Method Summary collapse

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

#compose!, #errors, included, #validate, #validator

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

#[], #add_warning, #ancestors, #array?, aspects, #compose!, default, #descendants, #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

Class Method Details

.applies_to?(config) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/gitlab/ci/config/entry/variable.rb', line 46

def applies_to?(config)
  config.is_a?(Hash)
end

Instance Method Details

#valueObject



77
78
79
80
# File 'lib/gitlab/ci/config/entry/variable.rb', line 77

def value
  # Needed since the `Entry::Node` provides `value` (which is current hash)
  config_value.to_s
end

#value_with_dataObject



82
83
84
85
86
87
# File 'lib/gitlab/ci/config/entry/variable.rb', line 82

def value_with_data
  {
    value: config_value.to_s,
    raw: (!config_expand if has_config_expand?)
  }.compact
end

#value_with_prefill_dataObject



89
90
91
92
93
94
# File 'lib/gitlab/ci/config/entry/variable.rb', line 89

def value_with_prefill_data
  value_with_data.merge(
    description: config_description,
    options: config_options
  ).compact
end