recipes/config.rb
def h_to_a(obj) # rubocop:disable Metrics/AbcSize
  if obj.is_a?(Hash)
    obj =
      if obj.keys.map { |k| !k.to_s.start_with?('index_') }.any? || obj.empty?
        obj.map { |k, v| [k, h_to_a(v)] }.to_h
      else
        obj.values
      end
  end
  obj.is_a?(Array) ? obj.map { |v| h_to_a(v) } : obj
end
# Convert hash entry when key is named 'index_.*' to an array item
Convert hash entry when key is named 'index_.*' to an array item
Convert hash entry when key is named ' index_ . * ' to an array item
def h_to_a(obj) 
  if obj.is_a?(Hash)
    obj =
      if obj.keys.map { |k| !k.to_s.start_with?('index_') }.any? || obj.empty?
        obj.map { |k, v| [k, h_to_a(v)] }.to_h
      else
        obj.values
      end
  end
  obj.is_a?(Array) ? obj.map { |v| h_to_a(v) } : obj
end
def h_to_a ( obj ) if obj . is_a? ( Hash ) obj = if obj . keys . map { | k | ! k . to_s . start_with? ( 'index_' ) } . any? || obj . empty? obj . map { | k , v | [ k , h_to_a ( v ) ] } . to_h else obj . values end end obj . is_a? ( Array ) ? obj . map { | v | h_to_a ( v ) } : obj end
Convert hash entry when key is named 'index_.
Convert hash entry when key is named ' index_ .
# rubocop:disable Metrics/AbcSize
obj