Class: NSUserDefaults

Inherits:
Object
  • Object
show all
Defined in:
motion/core/ns_user_defaults.rb

Overview

Reopens the NSUserDefaults class to add Array like accessors

See Also:

Instance Method Summary (collapse)

Instance Method Details

- (Object) [](key)

Retrieves the object for the passed key



6
7
8
# File 'motion/core/ns_user_defaults.rb', line 6

def [](key)
  self.objectForKey(key.to_s)
end

- (Object) []=(key, val)

Sets the value for a given key and save it right away.



11
12
13
14
# File 'motion/core/ns_user_defaults.rb', line 11

def []=(key, val)
  self.setObject(val, forKey: key.to_s)
  self.synchronize
end