1 # Custom Puppet function to convert dos to unix format
2 module Puppet::Parser::Functions
3 newfunction(:dos2unix, :type => :rvalue, :arity => 1, :doc => <<-DOC
5 Returns the Unix version of the given string.
7 Takes a single string argument.
9 @return The retrieved version
13 unless arguments[0].is_a?(String)
14 raise(Puppet::ParseError, 'dos2unix(): Requires string as argument')
17 arguments[0].gsub(%r{\r\n}, "\n")