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