Commit eb151e77 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extract CI configuration entry node factory method

parent b4f03e8b
...@@ -21,20 +21,24 @@ module Gitlab ...@@ -21,20 +21,24 @@ module Gitlab
def create! def create!
raise InvalidFactory unless @attributes.has_key?(:value) 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. # We assume that unspecified entry is undefined.
# See issue #18775. # See issue #18775.
# #
if @attributes[:value].nil? if @attributes[:value].nil?
node, value = Node::Undefined, @node Node::Undefined.new(@node)
else else
node, value = @node, @attributes[:value] @node.new(@attributes[:value])
end
node.new(value).tap do |entry|
entry.key = @attributes[:key]
entry.parent = @attributes[:parent]
entry.description = @attributes[:description]
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment