aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mga-common/lib
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-05-23 15:06:39 +0000
committerNicolas Vigier <boklm@mageia.org>2013-05-23 15:06:39 +0000
commit4ff7fabb70a0b83e343ce444931e645bac22c7c1 (patch)
treee43d9a2685c4b70dfa70b735baebcac009abbbe0 /modules/mga-common/lib
parenta2b2161af256fb557480c2fcf3b2f3e68538f5f2 (diff)
downloadpuppet-4ff7fabb70a0b83e343ce444931e645bac22c7c1.tar
puppet-4ff7fabb70a0b83e343ce444931e645bac22c7c1.tar.gz
puppet-4ff7fabb70a0b83e343ce444931e645bac22c7c1.tar.bz2
puppet-4ff7fabb70a0b83e343ce444931e645bac22c7c1.tar.xz
puppet-4ff7fabb70a0b83e343ce444931e645bac22c7c1.zip
Add str_join function
A function to join elements from an array to create a string.
Diffstat (limited to 'modules/mga-common/lib')
-rw-r--r--modules/mga-common/lib/puppet/parser/functions/str_join.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/mga-common/lib/puppet/parser/functions/str_join.rb b/modules/mga-common/lib/puppet/parser/functions/str_join.rb
new file mode 100644
index 00000000..de97bfb5
--- /dev/null
+++ b/modules/mga-common/lib/puppet/parser/functions/str_join.rb
@@ -0,0 +1,11 @@
+# str_join($array, $sep)
+# -> return a string created by converting each element of the array to
+# a string, separated by $sep
+
+module Puppet::Parser::Functions
+ newfunction(:str_join, :type => :rvalue) do |args|
+ array = args[0]
+ sep = args[1]
+ return array.join(sep)
+ end
+end