Class: Gitlab::Ci::Config::Extendable

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/gitlab/ci/config/extendable.rb,
lib/gitlab/ci/config/extendable/entry.rb

Defined Under Namespace

Classes: Entry

Constant Summary collapse

ExtensionError =
Class.new(StandardError)

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Extendable

Returns a new instance of Extendable.



11
12
13
14
15
# File 'lib/gitlab/ci/config/extendable.rb', line 11

def initialize(hash)
  @hash = hash.to_h.deep_dup

  each { |entry| entry.extend! if entry.extensible? }
end

Instance Method Details

#eachObject



17
18
19
20
21
# File 'lib/gitlab/ci/config/extendable.rb', line 17

def each
  @hash.each_key do |key|
    yield Extendable::Entry.new(key, @hash)
  end
end

#to_hashObject



23
24
25
# File 'lib/gitlab/ci/config/extendable.rb', line 23

def to_hash
  @hash.to_h
end