puppetlabs/puppetlabs-stdlib — pull request #143 by dalen (2013-04-10 12:44:25+00:00)
Title: Add a count function

Similar to the ruby count method on arrays.

Can be useful if for example for defines that have two or more arguments that it needs but are mutually exclusive. For example defines that wrap the file type and passes on content, source and/or target.

So instead of doing:
```puppet
unless ($source and not ($content or $target)) or ($target and not ($content or $source)) or ($content and not ($source or $target)) { fail() }
```

You can do:
```puppet
unless count([$source,$target,$content])==1 { fail() }
```