diff options
author | intrigeri <intrigeri@boum.org> | 2010-12-11 13:15:33 +0100 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2010-12-11 13:15:33 +0100 |
commit | 1f1e5599b7a527b9889b5d2c8a92df8b2916cde7 (patch) | |
tree | 04edffd598bc3df9655b2e4981d9a348be6f4812 /lib/puppet/parser/functions/uniq_flatten.rb | |
parent | 001bbc5ff82337e6ddc7b13fb337b43ed36d2dee (diff) | |
parent | a81984c77ed1efb56e978d8b5050b6c3ec409d80 (diff) | |
download | puppet-common-1f1e5599b7a527b9889b5d2c8a92df8b2916cde7.tar.gz puppet-common-1f1e5599b7a527b9889b5d2c8a92df8b2916cde7.tar.bz2 |
Merge remote branch 'shared/master'
Conflicts:
lib/puppet/parser/functions/split.rb
Diffstat (limited to 'lib/puppet/parser/functions/uniq_flatten.rb')
-rw-r--r-- | lib/puppet/parser/functions/uniq_flatten.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/uniq_flatten.rb b/lib/puppet/parser/functions/uniq_flatten.rb new file mode 100644 index 0000000..4841c4d --- /dev/null +++ b/lib/puppet/parser/functions/uniq_flatten.rb @@ -0,0 +1,10 @@ +Puppet::Parser::Functions::newfunction( + :uniq_flatten, + :type => :rvalue, + :doc => "Flattens an array and make it uniq + + Example: uniq_flatten([['a','b'],'a']) -> ['a','b']" +) do |args| + raise Puppet::ParseError, 'uniq_flatten() needs one arguments' if args.length != 1 + args[0].to_a.flatten.collect(&:to_s).uniq +end |