Sha256: d8285f76ead3883d849dd30c8ff0df067f59b288801eb3c7218e3d8023328d21

Contents?: true

Size: 375 Bytes

Versions: 4

Compression:

Stored size: 375 Bytes

Contents

class NSUserDefaults

  class << self
    # Retrieves the object for the passed key
    def [](key)
      self.standardUserDefaults.objectForKey(key.to_s)
    end

    # Sets the value for a given key and save it right away.
    def []=(key, val)
      self.standardUserDefaults.setObject(val, forKey: key.to_s)
      self.standardUserDefaults.synchronize
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sugarcube-0.11.3 lib/sugarcube/nsuserdefaults.rb
sugarcube-0.11.2 lib/sugarcube/nsuserdefaults.rb
sugarcube-0.11.1 lib/sugarcube/nsuserdefaults.rb
sugarcube-0.11 lib/sugarcube/nsuserdefaults.rb