Module: Xcode::Configuration::TargetedDeviceFamily

Extended by:
TargetedDeviceFamily
Included in:
TargetedDeviceFamily
Defined in:
lib/xcode/configurations/targeted_device_family_property.rb

Overview

Within the a build settings there is a setting for the Targeted Device Family which assigns particular numeric values to the platform types.

Instead of manipulating the numeric values, this will perform a conversion return an array of symbols with the platforms like :iphone and :ipad.

Instance Method Summary collapse

Instance Method Details

#append(original, value) ⇒ Object

Parameters:

  • original (String)

    is the current string value stored in the configuration that needs to be converted into an Array of names.

  • value (String, Array<String>)

    the new values to include in the device family.



42
43
44
# File 'lib/xcode/configurations/targeted_device_family_property.rb', line 42

def append(original,value)
  save(open(original) + Array(value))
end

#open(value) ⇒ Array<Symbol>

Returns the platform names supported.

Parameters:

  • value (String)

    convert the comma-delimited list of platforms

Returns:

  • (Array<Symbol>)

    the platform names supported.



19
20
21
22
23
# File 'lib/xcode/configurations/targeted_device_family_property.rb', line 19

def open(value)
  value.to_s.split(",").map do |platform_number|
    platforms[platform_number]
  end
end

#save(value) ⇒ String

Returns the comma-delimited list of numeric values representing the platforms.

Parameters:

Returns:

  • (String)

    the comma-delimited list of numeric values representing the platforms.



30
31
32
33
34
# File 'lib/xcode/configurations/targeted_device_family_property.rb', line 30

def save(value)
  Array(value).map do |platform_name|
    platforms.map {|number,name| number if name.to_s == platform_name.to_s.downcase }
  end.flatten.compact.uniq.join(",")
end