Puppet Function: dos2unix

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

Summary

Returns the Unix version of the given string.

Overview

dos2unix()Any

Takes a single string argument.

Returns:

  • (Any)

    The retrieved version



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

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

  Takes a single string argument.

  @return The retrieved version
  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