Signed-off-by: James Turnbull <[email protected]> --- lib/puppet/parser/functions/split.rb | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) create mode 100644 lib/puppet/parser/functions/split.rb
diff --git a/lib/puppet/parser/functions/split.rb b/lib/puppet/parser/functions/split.rb new file mode 100644 index 0000000..c555d67 --- /dev/null +++ b/lib/puppet/parser/functions/split.rb @@ -0,0 +1,11 @@ +module Puppet::Parser::Functions + newfunction(:split, :type => :rvalue, + :doc => "Split a string variable into an array using the specified split character. +Usage:: + $string = 'value1,value2' + $array_var = split($string, ',') + +$array_var holds the result ['value1', 'value2']") do |args| + return args[0].split(args[1]) + end +end -- 1.6.0.6 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en -~----------~----~----~----~------~----~------~--~---
