Sha256: 3ac37865a23cf08553094224898ac940109081a81f6bf09ec446d7cc47829c24
Contents?: true
Size: 597 Bytes
Versions: 68
Compression:
Stored size: 597 Bytes
Contents
# Digs into a data structure. # (Documented in 3.x stub) # # @since 4.5.0 # Puppet::Functions.create_function(:dig) do dispatch :dig do param 'Optional[Collection]', :data repeated_param 'Any', :arg end def dig(data, *args) walked_path = [] args.reduce(data) do | d, k | return nil if d.nil? || k.nil? if !(d.is_a?(Array) || d.is_a?(Hash)) raise ArgumentError, _("The given data does not contain a Collection at %{walked_path}, got '%{klass}'") % { walked_path: walked_path, klass: d.class } end walked_path << k d[k] end end end
Version data entries
68 entries across 68 versions & 2 rubygems