diff options
author | Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> | 2011-04-30 02:40:04 +0100 |
---|---|---|
committer | Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> | 2011-04-30 02:40:04 +0100 |
commit | b26d5b2f3be95737ea2df63ffccea5354d37d81e (patch) | |
tree | 879b688abc4090f47928f60b5c02c1f00b8f7ed4 /prefix.rb | |
parent | 5fce8a7f54ffca674205b063dd52b8ad35137685 (diff) | |
download | puppet-stdlib-b26d5b2f3be95737ea2df63ffccea5354d37d81e.tar.gz puppet-stdlib-b26d5b2f3be95737ea2df63ffccea5354d37d81e.tar.bz2 |
Now prefix will convert everything into string which is the same
as join would do. Also function is now more robust in error detection.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Diffstat (limited to 'prefix.rb')
-rw-r--r-- | prefix.rb | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -19,11 +19,20 @@ module Puppet::Parser::Functions prefix = arguments[1] if arguments[1] - result = array.collect { |i| prefix ? prefix + i : i } + if prefix + unless prefix.is_a?(String) + raise(Puppet::ParseError, 'prefix(): Requires string to work with') + end + end + + # Turn everything into string same as join would do ... + result = array.collect do |i| + i = i.to_s + prefix ? prefix + i : i + end return result end end # vim: set ts=2 sw=2 et : - |