module-common/lib/puppet/parser/functions/uniq_flatten.rb
mh 218c68752e go on uniq strings
Looks like puppet has some internal representation which
is not comparable.
2010-11-07 13:37:27 -05:00

10 lines
326 B
Ruby

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