Puppet Function: unix2dos

Defined in:
vendor_modules/stdlib/lib/puppet/parser/functions/unix2dos.rb
Function type:
Ruby 3.x API

Summary

Returns the DOS version of the given string.

Overview

unix2dos()Any

Takes a single string argument.

Returns:

  • (Any)

    the DOS version of the given string.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'vendor_modules/stdlib/lib/puppet/parser/functions/unix2dos.rb', line 5

newfunction(:unix2dos, type: :rvalue, arity: 1, doc: <<-DOC
  @summary
    Returns the DOS version of the given string.

  @return
    the DOS version of the given string.

  Takes a single string argument.
  DOC
) do |arguments|
  unless arguments[0].is_a?(String)
    raise(Puppet::ParseError, 'unix2dos(): Requires string as argument')
  end

  arguments[0].gsub(%r{\r*\n}, "\r\n")
end