Concatenate arrays without modifying the first array
This commit is contained in:
parent
c5f6c26d67
commit
85d5eadbab
1 changed files with 1 additions and 5 deletions
|
@ -28,11 +28,7 @@ Would result in:
|
||||||
raise(Puppet::ParseError, 'concat(): Requires array to work with')
|
raise(Puppet::ParseError, 'concat(): Requires array to work with')
|
||||||
end
|
end
|
||||||
|
|
||||||
if b.is_a?(Array)
|
result = a + Array(b)
|
||||||
result = a.concat(b)
|
|
||||||
else
|
|
||||||
result = a << b
|
|
||||||
end
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue