Class: RXCode::Preferences

Inherits:
Object
  • Object
show all
Defined in:
lib/rxcode/preferences.rb

Overview

Provides access to global XCode preferences.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(defaults = nil) ⇒ Preferences

Returns a new instance of Preferences.



16
17
18
19
20
# File 'lib/rxcode/preferences.rb', line 16

def initialize(defaults = nil)
  defaults ||= Plist::parse_xml(`defaults read com.apple.dt.Xcode | plutil -convert xml1 -o - -`)
  
  @defaults = defaults
end

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



14
15
16
# File 'lib/rxcode/preferences.rb', line 14

def defaults
  @defaults
end

Instance Method Details

#derived_data_locationObject



22
23
24
# File 'lib/rxcode/preferences.rb', line 22

def derived_data_location
  defaults['IDECustomDerivedDataLocation'] || File.expand_path("~/Library/Developer/Xcode/DerivedData")
end

#derived_data_location_is_relative_to_workspace?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/rxcode/preferences.rb', line 26

def derived_data_location_is_relative_to_workspace?
  !derived_data_location.start_with?('/')
end