1 2 3 4 5 6
# escape slashes in a String module Puppet::Parser::Functions newfunction(:slash_escape, :type => :rvalue) do |args| args[0].gsub(/\//, '\\/') end end