Files
zulip/puppet/puppet-common/lib/puppet/parser/functions/split.rb
Zev Benjamin dd678465ae [manual] Move puppet modules to the top level
The new puppet.conf file has to be moved into place manually.

(imported from commit 253d9a95386dae8c803a998ce2dc7e8be40c880a)
2013-10-30 15:42:26 -04:00

18 lines
504 B
Ruby

# split($string, $delimiter) : $string
# split($string[], $delimiter) : $string[][]
#
# Split the first argument(s) on every $delimiter. $delimiter is interpreted as
# Ruby regular expression.
#
# For long-term portability it is recommended to refrain from using Ruby's
# extended RE features.
module Puppet::Parser::Functions
newfunction(:split, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args.collect do |a| a.split(/#{args[1]}/) end
else
args[0].split(/#{args[1]}/)
end
end
end