Puppet Function: gitlab_ci_runner::to_toml

Defined in:
lib/puppet/functions/gitlab_ci_runner/to_toml.rb
Function type:
Ruby 4.x API

Summary

Convert a data structure and output to TOML.

Overview

gitlab_ci_runner::to_toml(Hash $data)String

Examples:

How to output TOML to a file

file { '/tmp/config.toml':
  ensure  => file,
  content => to_toml($myhash),
}

Parameters:

  • data (Hash)

    Data structure which needs to be converted into TOML

Returns:

  • (String)

    Converted data as TOML string



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/puppet/functions/gitlab_ci_runner/to_toml.rb', line 5

Puppet::Functions.create_function(:'gitlab_ci_runner::to_toml') do
  # @param data Data structure which needs to be converted into TOML
  # @return [String] Converted data as TOML string
  # @example How to output TOML to a file
  #     file { '/tmp/config.toml':
  #       ensure  => file,
  #       content => to_toml($myhash),
  #     }
  dispatch :to_toml do
    required_param 'Hash', :data
    return_type 'String'
  end

  def to_toml(data)
    PuppetX::Gitlab::Dumper.new(data).toml_str
  end
end