class NSDictionary

Public Class Methods

read_from(path_or_url) click to toggle source
# File lib/cocoa/sugarcube-files/nsdictionary.rb, line 5
def read_from(path_or_url)
  case path_or_url
  when NSURL
    self.dictionaryWithContentsOfURL(path_or_url)
  when NSString
    self.dictionaryWithContentsOfFile(path_or_url)
  else
    false
  end
end

Public Instance Methods

to_nsuserdefaults() click to toggle source
# File lib/cocoa/sugarcube-nsuserdefaults/nsuserdefaults.rb, line 50
def to_nsuserdefaults
  self.each_with_object({}) { |(key, val), h| h[key] = val.to_nsuserdefaults }
end
to_object() click to toggle source
# File lib/cocoa/sugarcube-anonymous/anonymous.rb, line 89
def to_object
  SugarCube::Anonymous[self]
end
write_to(path_or_url, atomically=true) click to toggle source
# File lib/cocoa/sugarcube-files/nsdictionary.rb, line 18
def write_to(path_or_url, atomically=true)
  case path_or_url
  when NSURL
    self.writeToURL(path_or_url, atomically: atomically)
  when NSString
    self.writeToFile(path_or_url, atomically: atomically)
  else
    false
  end
end