module Puppet::Pops::Serialization::JsonPath
Public Class Methods
to_json_path(path)
click to toggle source
Creates a json_path reference from the given `path` argument
@path path [Array<Integer,String>] An array of integers and strings @return [String] the created json_path
@api private
# File lib/puppet/pops/serialization/json_path.rb 12 def self.to_json_path(path) 13 p = '$' 14 path.each do |seg| 15 if seg.nil? 16 p << '[null]' 17 elsif Types::PScalarDataType::DEFAULT.instance?(seg) 18 p << '[' << Types::StringConverter.singleton.convert(seg, '%p') << ']' 19 else 20 # Unable to construct json path from complex segments 21 return nil 22 end 23 end 24 p 25 end