Class: Gitlab::Ci::Config::Yaml::Tags::Base

Inherits:
Object
  • Object
show all
Extended by:
Utils::Override
Defined in:
lib/gitlab/ci/config/yaml/tags/base.rb

Direct Known Subclasses

Reference

Constant Summary collapse

CircularReferenceError =
Class.new(Tags::TagError)
NotValidError =
Class.new(Tags::TagError)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Instance Attribute Details

#dataObject

Returns the value of attribute data.



14
15
16
# File 'lib/gitlab/ci/config/yaml/tags/base.rb', line 14

def data
  @data
end

#resolved_statusObject

Returns the value of attribute resolved_status.



14
15
16
# File 'lib/gitlab/ci/config/yaml/tags/base.rb', line 14

def resolved_status
  @resolved_status
end

#resolved_valueObject

Returns the value of attribute resolved_value.



14
15
16
# File 'lib/gitlab/ci/config/yaml/tags/base.rb', line 14

def resolved_value
  @resolved_value
end

Class Method Details

.tagObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/gitlab/ci/config/yaml/tags/base.rb', line 16

def self.tag
  raise NotImplementedError
end

Instance Method Details

#init_with(coder) ⇒ Object

Only one of the ‘seq`, `scalar`, `map` fields is available.



21
22
23
24
25
26
27
28
29
# File 'lib/gitlab/ci/config/yaml/tags/base.rb', line 21

def init_with(coder)
  @data = {
    tag: coder.tag,       # This is the custom YAML tag, like !reference or !flatten
    style: coder.style,
    seq: coder.seq,       # This holds Array data
    scalar: coder.scalar, # This holds data of basic types, like String.
    map: coder.map        # This holds Hash data.
  }
end

#resolve(resolver) ⇒ Object

Raises:



35
36
37
38
39
40
41
42
43
44
# File 'lib/gitlab/ci/config/yaml/tags/base.rb', line 35

def resolve(resolver)
  raise NotValidError, validation_error_message unless valid?
  raise CircularReferenceError, circular_error_message if resolving?
  return resolved_value if resolved?

  self.resolved_status = :in_progress
  self.resolved_value = _resolve(resolver)
  self.resolved_status = :done
  resolved_value
end

#valid?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/gitlab/ci/config/yaml/tags/base.rb', line 31

def valid?
  raise NotImplementedError
end