diff options
author | Martin Foot <martin@modeltwozero.com> | 2014-02-21 14:32:32 +0000 |
---|---|---|
committer | Martin Foot <martin@modeltwozero.com> | 2014-02-21 15:48:27 +0000 |
commit | 35bf5fd8c93d5052ecf5284ed3194a92cab838d5 (patch) | |
tree | 7d2cfde612643014511baad8d4174841c1f14e42 /lib/puppet | |
parent | ab981422a67636441f1bfebaaade36aa690f1f25 (diff) | |
download | puppet-stdlib-35bf5fd8c93d5052ecf5284ed3194a92cab838d5.tar.gz puppet-stdlib-35bf5fd8c93d5052ecf5284ed3194a92cab838d5.tar.bz2 |
Allow concat to take non-array second parameters
Also improve and extend concat tests to lock down functionality
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/parser/functions/concat.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/puppet/parser/functions/concat.rb b/lib/puppet/parser/functions/concat.rb index c86aa00..6c86382 100644 --- a/lib/puppet/parser/functions/concat.rb +++ b/lib/puppet/parser/functions/concat.rb @@ -23,12 +23,16 @@ Would result in: a = arguments[0] b = arguments[1] - # Check that both args are arrays. - unless a.is_a?(Array) and b.is_a?(Array) + # Check that the first parameter is an array + unless a.is_a?(Array) raise(Puppet::ParseError, 'concat(): Requires array to work with') end - result = a.concat(b) + if b.is_a?(Array) + result = a.concat(b) + else + result = a << b + end return result end |