Class: DevToolsCore::NSData

Inherits:
NSObject show all
Defined in:
lib/xcodeproj/plist_helper.rb

Ruby value to CFTypeRef conversion collapse

Constructor Details

#initialize(data) ⇒ NSData

Returns a new instance of NSData.



684
685
686
# File 'lib/xcodeproj/plist_helper.rb', line 684

def initialize(data)
  @data = data
end

Instance Method Details

#writeToFileAtomically(path) ⇒ Object



688
689
690
691
692
693
694
695
696
697
698
699
# File 'lib/xcodeproj/plist_helper.rb', line 688

def writeToFileAtomically(path)
  selector = 'writeToFile:atomically:'
  return false unless NSObject.respondsToSelector(@data, selector)

  writeToFileAtomically = NSData.objc_msgSend([CoreFoundation::VoidPointer, CoreFoundation::Boolean], CoreFoundation::Boolean)
  result = writeToFileAtomically.call(
    @data,
    CoreFoundation.NSSelectorFromString(CoreFoundation.RubyStringToCFString(selector)),
    CoreFoundation.RubyStringToCFString(path),
    1)
  result == CoreFoundation::TRUE ? true : false
end