Make fabrication of default config entry more readable

This commit is contained in:
Grzegorz Bizon 2019-01-14 14:27:31 +01:00
parent 8b185467e4
commit 67e90a123f
2 changed files with 7 additions and 5 deletions

View File

@ -150,7 +150,7 @@ module Gitlab
stage: stage_value,
cache: cache_value,
only: only_value,
except: except_value.to_h,
except: except_value,
variables: variables_defined? ? variables_value : nil,
environment: environment_defined? ? environment_value : nil,
environment_name: environment_defined? ? environment_value[:name] : nil,

View File

@ -53,10 +53,12 @@ module Gitlab
# If entry has a default value we fabricate concrete node
# with default value.
#
if @entry.default(@attributes).nil?
fabricate(Entry::Undefined)
else
fabricate(@entry, @entry.default(@attributes))
@entry.default(@attributes).yield_self do |default|
if default.nil?
fabricate(Entry::Undefined)
else
fabricate(@entry, default)
end
end
end