Class: Xcodeproj::XCScheme::EnvironmentVariable
- Inherits:
- 
      XMLElementWrapper
      
        - Object
- XMLElementWrapper
- Xcodeproj::XCScheme::EnvironmentVariable
 
- Defined in:
- lib/xcodeproj/scheme/environment_variables.rb
Overview
This class wraps the EnvironmentVariable node of a .xcscheme XML file. Environment variables are accessible via the NSDictionary returned from
- [NSProcessInfo processInfo
- 
environment] in your app code. 
Instance Attribute Summary
Attributes inherited from XMLElementWrapper
Instance Method Summary collapse
- 
  
    
      #enabled  ⇒ Bool 
    
    
  
  
  
  
  
  
  
  
  
    Returns the EnvironmentValue’s enabled state. 
- 
  
    
      #enabled=(enabled)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Sets the EnvironmentValue’s enabled state. 
- 
  
    
      #initialize(node_or_variable)  ⇒ EnvironmentVariable 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of EnvironmentVariable. 
- 
  
    
      #key  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Returns the EnvironmentValue’s key. 
- 
  
    
      #key=(key)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Sets the EnvironmentValue’s key. 
- 
  
    
      #to_h  ⇒ Hash{:key => String, :value => String, :enabled => Bool} 
    
    
  
  
  
  
  
  
  
  
  
    The environment variable XML node with attributes converted to a representative Hash. 
- 
  
    
      #value  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Returns the EnvironmentValue’s value. 
- 
  
    
      #value=(value)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Sets the EnvironmentValue’s value. 
Methods inherited from XMLElementWrapper
Constructor Details
#initialize(node_or_variable) ⇒ EnvironmentVariable
Returns a new instance of EnvironmentVariable.
| 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | # File 'lib/xcodeproj/scheme/environment_variables.rb', line 104 def initialize(node_or_variable) create_xml_element_with_fallback(node_or_variable, VARIABLE_NODE) do raise "Must pass a Hash with 'key' and 'value'!" unless node_or_variable.is_a?(Hash) && node_or_variable.key?(:key) && node_or_variable.key?(:value) @xml_element.attributes['key'] = node_or_variable[:key] @xml_element.attributes['value'] = node_or_variable[:value] @xml_element.attributes['isEnabled'] = if node_or_variable.key?(:enabled) bool_to_string(node_or_variable[:enabled]) else bool_to_string(true) end end end | 
Instance Method Details
#enabled ⇒ Bool
Returns the EnvironmentValue’s enabled state
| 151 152 153 | # File 'lib/xcodeproj/scheme/environment_variables.rb', line 151 def enabled string_to_bool(@xml_element.attributes['isEnabled']) end | 
#enabled=(enabled) ⇒ Object
Sets the EnvironmentValue’s enabled state
| 158 159 160 | # File 'lib/xcodeproj/scheme/environment_variables.rb', line 158 def enabled=(enabled) @xml_element.attributes['isEnabled'] = bool_to_string(enabled) end | 
#key ⇒ String
Returns the EnvironmentValue’s key
| 123 124 125 | # File 'lib/xcodeproj/scheme/environment_variables.rb', line 123 def key @xml_element.attributes['key'] end | 
#key=(key) ⇒ Object
Sets the EnvironmentValue’s key
| 130 131 132 | # File 'lib/xcodeproj/scheme/environment_variables.rb', line 130 def key=(key) @xml_element.attributes['key'] = key end | 
#to_h ⇒ Hash{:key => String, :value => String, :enabled => Bool}
Returns The environment variable XML node with attributes converted to a representative Hash.
| 165 166 167 | # File 'lib/xcodeproj/scheme/environment_variables.rb', line 165 def to_h { :key => key, :value => value, :enabled => enabled } end | 
#value ⇒ String
Returns the EnvironmentValue’s value
| 137 138 139 | # File 'lib/xcodeproj/scheme/environment_variables.rb', line 137 def value @xml_element.attributes['value'] end | 
#value=(value) ⇒ Object
Sets the EnvironmentValue’s value
| 144 145 146 | # File 'lib/xcodeproj/scheme/environment_variables.rb', line 144 def value=(value) @xml_element.attributes['value'] = value end |