File: dump_args.rb

package info (click to toggle)
puppet-module-extlib 7.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 420 kB
  • sloc: ruby: 1,035; sh: 15; makefile: 10
file content (22 lines) | stat: -rw-r--r-- 650 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'json'

# @summary Prints the args to STDOUT in Pretty JSON format.
#
# Prints the args to STDOUT in Pretty JSON format.
#
# Useful for debugging purposes only. Ideally you would use this in
# conjunction with a rspec-puppet unit test.  Otherwise the output will
# be shown during a puppet run when verbose/debug options are enabled.
Puppet::Functions.create_function(:'extlib::dump_args') do
  # @param args The data you want to dump as pretty JSON.
  # @return [Undef] Returns nothing.
  dispatch :dump_args do
    param 'Any', :args
  end

  def dump_args(args)
    puts JSON.pretty_generate(args)
  end
end