Puppet Function: dcos_sorted_json
- Defined in:
- lib/puppet/parser/functions/dcos_sorted_json.rb
- Function type:
- Ruby 3.x API
Overview
This function takes data, outputs making sure the hash keys are sorted Examples:
sorted_json({'key'=>'value'})
Would return: ‘key’:‘value’
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/puppet/parser/functions/dcos_sorted_json.rb', line 29 newfunction(:dcos_sorted_json, :type => :rvalue, :doc => <<-EOS This function takes data, outputs making sure the hash keys are sorted *Examples:* sorted_json({'key'=>'value'}) Would return: {'key':'value'} EOS ) do |arguments| raise(Puppet::ParseError, "sorted_json(): Wrong number of arguments " + "given (#{arguments.size} for 1)") if arguments.size != 1 json = arguments[0] return sorted_json(json) end |