Module: Xcode::Configuration::KeyValueArrayProperty

Extended by:
KeyValueArrayProperty
Included in:
KeyValueArrayProperty
Defined in:
lib/xcode/configurations/key_value_array_property.rb

Overview

Within the a build settings for a configuration there are a number of settings that are stored as key-value pairs in Arrays.

Instance Method Summary collapse

Instance Method Details

#append(original, value) ⇒ Object

To ensure uniqueness, the original value array is added to the new value array and then all the key-values pairs are placed in a Hash then mapped back out to a key=value pair array.



34
35
36
37
# File 'lib/xcode/configurations/key_value_array_property.rb', line 34

def append(original,value)
  all_values = (open(original) + Array(value)).map {|key_value| key_value.split("=") }.flatten
  Hash[*all_values].map {|k,v| "#{k}=#{v}" }
end

#open(value) ⇒ Object

As arrays are stored as arrays this is not particularly different.

Parameters:

  • value (Array)

    to be parsed into the correct format



17
18
19
# File 'lib/xcode/configurations/key_value_array_property.rb', line 17

def open(value)
  Array(value)
end

#save(value) ⇒ Object

Parameters:

  • value (Nil, Array, String)

    that is being saved back which can be in a multitude of formats as long as it responds_to? #to_a



25
26
27
# File 'lib/xcode/configurations/key_value_array_property.rb', line 25

def save(value)
  Array(value)
end