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/array_del.rb | |
parent | 001bbc5ff82337e6ddc7b13fb337b43ed36d2dee (diff) | |
parent | a81984c77ed1efb56e978d8b5050b6c3ec409d80 (diff) |
Merge remote branch 'shared/master'
Conflicts:
lib/puppet/parser/functions/split.rb
Diffstat (limited to 'lib/puppet/parser/functions/array_del.rb')
-rw-r--r-- | lib/puppet/parser/functions/array_del.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/array_del.rb b/lib/puppet/parser/functions/array_del.rb new file mode 100644 index 0000000..e604916 --- /dev/null +++ b/lib/puppet/parser/functions/array_del.rb @@ -0,0 +1,11 @@ +Puppet::Parser::Functions::newfunction( + :array_del, + :type => :rvalue, + :doc => "Deletes items from an array + + Example: array_del(['a','b'],'b') -> ['a']" +) do |args| + raise Puppet::ParseError, 'array_del() needs two arguments' if args.length != 2 + (res=args[0].dup).to_a.delete(args[1]) + res +end |