Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / dos2unix.rb
1 # Custom Puppet function to convert dos to unix format
2 module Puppet::Parser::Functions
3   newfunction(:dos2unix, :type => :rvalue, :arity => 1, :doc => <<-DOC
4     @summary
5       Returns the Unix version of the given string.
6
7     Takes a single string argument.
8
9     @return The retrieved version
10     DOC
11              ) do |arguments|
12
13     unless arguments[0].is_a?(String)
14       raise(Puppet::ParseError, 'dos2unix(): Requires string as argument')
15     end
16
17     arguments[0].gsub(%r{\r\n}, "\n")
18   end
19 end