Class: Xcodeproj::XCScheme::CommandLineArgument
- Inherits:
- 
      XMLElementWrapper
      
        - Object
- XMLElementWrapper
- Xcodeproj::XCScheme::CommandLineArgument
 
- Defined in:
- lib/xcodeproj/scheme/command_line_arguments.rb
Overview
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. 
Instance Attribute Summary
Attributes inherited from XMLElementWrapper
Instance Method Summary collapse
- 
  
    
      #argument  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Returns the CommandLineArgument’s key. 
- 
  
    
      #argument=(argument)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Sets the CommandLineArgument’s key. 
- 
  
    
      #enabled  ⇒ Bool 
    
    
  
  
  
  
  
  
  
  
  
    Returns the CommandLineArgument’s enabled state. 
- 
  
    
      #enabled=(enabled)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Sets the CommandLineArgument’s enabled state. 
- 
  
    
      #initialize(node_or_argument)  ⇒ CommandLineArgument 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of CommandLineArgument. 
- 
  
    
      #to_h  ⇒ Hash{:key => String, :value => String, :enabled => Bool} 
    
    
  
  
  
  
  
  
  
  
  
    The command line argument XML node with attributes converted to a representative Hash. 
Methods inherited from XMLElementWrapper
Constructor Details
#initialize(node_or_argument) ⇒ CommandLineArgument
Returns a new instance of CommandLineArgument.
| 112 113 114 115 116 117 118 119 120 121 122 123 124 | # 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 | 
Instance Method Details
#argument ⇒ String
Returns the CommandLineArgument’s key
| 129 130 131 | # File 'lib/xcodeproj/scheme/command_line_arguments.rb', line 129 def argument @xml_element.attributes['argument'] end | 
#argument=(argument) ⇒ Object
Sets the CommandLineArgument’s key
| 136 137 138 | # File 'lib/xcodeproj/scheme/command_line_arguments.rb', line 136 def argument=(argument) @xml_element.attributes['argument'] = argument end | 
#enabled ⇒ Bool
Returns the CommandLineArgument’s enabled state
| 143 144 145 | # File 'lib/xcodeproj/scheme/command_line_arguments.rb', line 143 def enabled string_to_bool(@xml_element.attributes['isEnabled']) end | 
#enabled=(enabled) ⇒ Object
Sets the CommandLineArgument’s enabled state
| 150 151 152 | # File 'lib/xcodeproj/scheme/command_line_arguments.rb', line 150 def enabled=(enabled) @xml_element.attributes['isEnabled'] = bool_to_string(enabled) end | 
#to_h ⇒ Hash{:key => String, :value => String, :enabled => Bool}
Returns The command line argument XML node with attributes converted to a representative Hash.
| 157 158 159 | # File 'lib/xcodeproj/scheme/command_line_arguments.rb', line 157 def to_h { :argument => argument, :enabled => enabled } end |