Sha256: 081ab84888d769cdb47775ba462fd6aeb794f95707bdb30ecf92ed651f6449f4

Contents?: true

Size: 467 Bytes

Versions: 2

Compression:

Stored size: 467 Bytes

Contents

# Reopens the NSUserDefaults class to add Array like accessors
# @see https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/nsuserdefaults_Class/Reference/Reference.html
class NSUserDefaults

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bubble-wrap-0.1.1 lib/bubble-wrap/ns_user_defaults.rb
bubble-wrap-0.1.0 lib/bubble-wrap/ns_user_defaults.rb