Puppet Function: rspamd::ucl::quote_string_value

Defined in:
vendor_modules/rspamd/lib/puppet/functions/rspamd/ucl/quote_string_value.rb
Function type:
Ruby 4.x API

Summary

quotes a string as a valid UCL string

Overview

rspamd::ucl::quote_string_value(String $value)Any
Note:

this is internal API and should never be required by users

Parameters:

Returns:

  • (Any)

Author:

  • Bernhard Frauendienst <puppet@nospam.obeliks.de>



8
9
10
11
12
13
14
15
16
17
18
19
# File 'vendor_modules/rspamd/lib/puppet/functions/rspamd/ucl/quote_string_value.rb', line 8

Puppet::Functions.create_function(:'rspamd::ucl::quote_string_value') do
  dispatch :to_ucl_string do
    param 'String', :value
  end

  def to_ucl_string(value)
    require 'json'

    # use json string encoding, this should be fully compatible with ucl
    JSON.generate(value, quirks_mode: true) # need quirks_mode to allow string generation
  end
end