lib/puppet/type/xldeploy_ci.rb
# Function to recursively iterate over hashes and arrays
# to find all values for a given key
Function to recursively iterate over hashes and arrays
to find all values for a given key
Function to recursively iterate over hashes and arrays to find all values for a given key
def recursive_values(obj, key)
      values = []
      if obj.is_a? Hash
        obj.each do |k, v|
          if k == key
            values = values << v
          else
            values = values + recursive_values(v, key)
          end
        end
      elsif obj.is_a? Array
        obj.each do |a|
          values = values + recursive_values(a, key)
        end
      end
      values
    end
def recursive_values ( obj , key ) values = [ ] if obj . is_a? Hash obj . each do | k , v | if k == key values = values << v else values = values + recursive_values ( v , key ) end end elsif obj . is_a? Array obj . each do | a | values = values + recursive_values ( a , key ) end end values end
Function to recursively iterate over hashes and arrays
to find all values for a given key
Function to recursively iterate over hashes and arrays to find all values for a given key
obj
<not_specific>
key
<not_specific>