blob: 32722ba501bd9389118d27d48005c973f4e5d450 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# Custom Puppet function to convert dos to unix format
module Puppet::Parser::Functions
newfunction(:dos2unix, :type => :rvalue, :arity => 1, :doc => <<-DOC
Returns the Unix version of the given string.
Takes a single string argument.
DOC
) do |arguments|
unless arguments[0].is_a?(String)
raise(Puppet::ParseError, 'dos2unix(): Requires string as argument')
end
arguments[0].gsub(%r{\r\n}, "\n")
end
end
|