lib/bolt/plugin.rb
# Iteratively resolves "top-level" references until the result no longer
# has top-level references. A top-level reference is one which is not
# contained within another hash. It may be either the actual top-level
# result or arbitrarily nested within arrays. If parameters of the
# reference are themselves references, they will be looked. Any remaining
# references nested inside the result will *not* be evaluated once the
# top-level result is not a reference.  This is used to resolve the
# `targets` and `groups` keys which are allowed to be references or
# arrays of references, but which may return data with nested references
# that should be resolved lazily. The end result will either be a single
# hash or a flat array of hashes.
Iteratively resolves "top-level" references until the result no longer
has top-level references. A top-level reference is one which is not
contained within another hash. It may be either the actual top-level
result or arbitrarily nested within arrays. If parameters of the
reference are themselves references, they will be looked. Any remaining
references nested inside the result will *not* be evaluated once the
top-level result is not a reference.  This is used to resolve the
`targets` and `groups` keys which are allowed to be references or
arrays of references, but which may return data with nested references
that should be resolved lazily. The end result will either be a single
hash or a flat array of hashes.
Iteratively resolves " top - level " references until the result no longer has top - level references . A top - level reference is one which is not contained within another hash . It may be either the actual top - level result or arbitrarily nested within arrays . If parameters of the reference are themselves references they will be looked . Any remaining references nested inside the result will * not * be evaluated once the top - level result is not a reference . This is used to resolve the ` targets ` and ` groups ` keys which are allowed to be references or arrays of references but which may return data with nested references that should be resolved lazily . The end result will either be a single hash or a flat array of hashes .
def resolve_top_level_references(data)
      if data.is_a?(Array)
        data.flat_map { |elem| resolve_top_level_references(elem) }
      elsif reference?(data)
        partially_resolved = data.transform_values do |v|
          resolve_references(v)
        end
        fully_resolved = resolve_single_reference(partially_resolved)
        resolve_top_level_references(fully_resolved)
      else
        data
      end
    end
def resolve_top_level_references ( data ) if data . is_a? ( Array ) data . flat_map { | elem | resolve_top_level_references ( elem ) } elsif reference? ( data ) partially_resolved = data . transform_values do | v | resolve_references ( v ) end fully_resolved = resolve_single_reference ( partially_resolved ) resolve_top_level_references ( fully_resolved ) else data end end
Iteratively resolves "top-level" references until the result no longer
has top-level references.
Iteratively resolves " top - level " references until the result no longer has top - level references .
# The top-level reference may have returned more references, so repeat the process
data
<not_specific>