projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git]
/
3rdparty
/
modules
/
stdlib
/
lib
/
puppet
/
functions
/
to_json_pretty.rb
diff --git
a/3rdparty/modules/stdlib/lib/puppet/functions/to_json_pretty.rb
b/3rdparty/modules/stdlib/lib/puppet/functions/to_json_pretty.rb
index
a7a1458
..
6a5a822
100644
(file)
--- a/
3rdparty/modules/stdlib/lib/puppet/functions/to_json_pretty.rb
+++ b/
3rdparty/modules/stdlib/lib/puppet/functions/to_json_pretty.rb
@@
-1,14
+1,15
@@
-# Take a data structure and output it as pretty JSON
+require 'json'
+# @summary
+# Convert data structure and output to pretty JSON
#
#
-# @example
how to output pretty JSON
-#
# output pretty json to a
file
+# @example
**Usage**
+#
* how to output pretty JSON to
file
# file { '/tmp/my.json':
# ensure => file,
# content => to_json_pretty($myhash),
# }
#
# file { '/tmp/my.json':
# ensure => file,
# content => to_json_pretty($myhash),
# }
#
-# @example how to output pretty JSON skipping over keys with undef values
-# # output pretty JSON to a file skipping over undef values
+# * how to output pretty JSON skipping over keys with undef values
# file { '/tmp/my.json':
# ensure => file,
# content => to_json_pretty({
# file { '/tmp/my.json':
# ensure => file,
# content => to_json_pretty({
@@
-16,10
+17,13
@@
# param_two => undef,
# }),
# }
# param_two => undef,
# }),
# }
-#
-require 'json'
-
Puppet::Functions.create_function(:to_json_pretty) do
Puppet::Functions.create_function(:to_json_pretty) do
+ # @param data
+ # data structure which needs to be converted to pretty json
+ # @param skip_undef
+ # value `true` or `false`
+ # @return
+ # converted data to pretty json
dispatch :to_json_pretty do
param 'Variant[Hash, Array]', :data
optional_param 'Boolean', :skip_undef
dispatch :to_json_pretty do
param 'Variant[Hash, Array]', :data
optional_param 'Boolean', :skip_undef