class Xcodeproj::XCScheme::CommandLineArgument
This class wraps the CommandLineArgument
node of a .xcscheme XML file. Environment arguments are accessible via the NSDictionary returned from
- [NSProcessInfo processInfo
-
arguments] in your app code.
Public Class Methods
new(node_or_argument)
click to toggle source
@param [nil,REXML::Element,Hash{Symbol => String,Bool}] node_or_argument
- If nil, it will create a default XML node to use - If a REXML::Element, should be a <CommandLineArgument> XML node to wrap - If a Hash, must contain keys :key and :value (Strings) and optionally :enabled (Boolean)
# File lib/xcodeproj/scheme/command_line_arguments.rb, line 112 def initialize(node_or_argument) create_xml_element_with_fallback(node_or_argument, COMMAND_LINE_ARG_NODE) do raise "Must pass a Hash with 'argument' and 'enabled'!" unless node_or_argument.is_a?(Hash) && node_or_argument.key?(:argument) && node_or_argument.key?(:enabled) @xml_element.attributes['argument'] = node_or_argument[:argument] @xml_element.attributes['isEnabled'] = if node_or_argument.key?(:enabled) bool_to_string(node_or_argument[:enabled]) else bool_to_string(false) end end end
Public Instance Methods
argument()
click to toggle source
Returns the CommandLineArgument’s key @return [String]
# File lib/xcodeproj/scheme/command_line_arguments.rb, line 129 def argument @xml_element.attributes['argument'] end
argument=(argument)
click to toggle source
Sets the CommandLineArgument’s key @param [String] key
# File lib/xcodeproj/scheme/command_line_arguments.rb, line 136 def argument=(argument) @xml_element.attributes['argument'] = argument end
enabled()
click to toggle source
Returns the CommandLineArgument’s enabled state @return [Bool]
# File lib/xcodeproj/scheme/command_line_arguments.rb, line 143 def enabled string_to_bool(@xml_element.attributes['isEnabled']) end
enabled=(enabled)
click to toggle source
Sets the CommandLineArgument’s enabled state @param [Bool] enabled
# File lib/xcodeproj/scheme/command_line_arguments.rb, line 150 def enabled=(enabled) @xml_element.attributes['isEnabled'] = bool_to_string(enabled) end
to_h()
click to toggle source
@return [Hash{:key => String, :value => String, :enabled => Bool}]
The command line argument XML node with attributes converted to a representative Hash
# File lib/xcodeproj/scheme/command_line_arguments.rb, line 157 def to_h { :argument => argument, :enabled => enabled } end