diff modules/stdlib/lib/puppet/functions/to_json.rb @ 478:adf6fe9bbc17

Update Puppet modules to latest versions
author IBBoard <dev@ibboard.co.uk>
date Thu, 29 Aug 2024 18:47:29 +0100
parents d9352a684e62
children
line wrap: on
line diff
--- a/modules/stdlib/lib/puppet/functions/to_json.rb	Tue Aug 27 13:35:17 2024 +0100
+++ b/modules/stdlib/lib/puppet/functions/to_json.rb	Thu Aug 29 18:47:29 2024 +0100
@@ -1,23 +1,14 @@
-require 'json'
-# @summary
-#   Convert a data structure and output to JSON
-#
-# @example how to output JSON
-#   # output json to a file
-#     file { '/tmp/my.json':
-#       ensure  => file,
-#       content => to_json($myhash),
-#     }
-#
+# frozen_string_literal: true
+
+# THIS FILE WAS GENERATED BY `rake regenerate_unamespaced_shims`
+
+# @summary DEPRECATED.  Use the namespaced function [`stdlib::to_json`](#stdlibto_json) instead.
 Puppet::Functions.create_function(:to_json) do
-  # @param data
-  #   data structure which needs to be converted into JSON
-  # @return converted data to json
-  dispatch :to_json do
-    param 'Any', :data
+  dispatch :deprecation_gen do
+    repeated_param 'Any', :args
   end
-
-  def to_json(data)
-    data.to_json
+  def deprecation_gen(*args)
+    call_function('deprecation', 'to_json', 'This function is deprecated, please use stdlib::to_json instead.', false)
+    call_function('stdlib::to_json', *args)
   end
 end