Method: Pod::YAMLHelper.process_array

Defined in:
lib/cocoapods-core/yaml_helper.rb

.process_array(array) ⇒ String (private)

Converts an array to YAML after sorting it.

Parameters:

  • array (Array)

    the array to convert.

Returns:

  • (String)

    the YAML representation of the given object.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/cocoapods-core/yaml_helper.rb', line 111

def process_array(array)
  return '[]' if array.empty?

  result = sorted_array(array).map do |array_value|
    processed = process_according_to_class(array_value)
    case array_value
    when Array, Hash
      if array_value.size > 1
        processed = processed.gsub(/^.*/).to_a
        head = processed.shift
        processed.map { |s| "  #{s}" }.prepend(head).join("\n")
      else
        processed
      end
    else
      processed
    end
  end
  "- #{result.join("\n- ").strip}"
end