提交 eb151e77 编写于 作者: G Grzegorz Bizon

Extract CI configuration entry node factory method

上级 b4f03e8b
......@@ -21,20 +21,24 @@ module Gitlab
def create!
raise InvalidFactory unless @attributes.has_key?(:value)
fabricate.tap do |entry|
entry.key = @attributes[:key]
entry.parent = @attributes[:parent]
entry.description = @attributes[:description]
end
end
private
def fabricate
##
# We assume that unspecified entry is undefined.
# See issue #18775.
#
if @attributes[:value].nil?
node, value = Node::Undefined, @node
Node::Undefined.new(@node)
else
node, value = @node, @attributes[:value]
end
node.new(value).tap do |entry|
entry.key = @attributes[:key]
entry.parent = @attributes[:parent]
entry.description = @attributes[:description]
@node.new(@attributes[:value])
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册