Class: NSUserDefaults
- Inherits:
-
Object
- Object
- NSUserDefaults
- Defined in:
- lib/PackingPeanut-ios/ns_user_defaults.rb
Overview
Reopens the NSUserDefaults class to add Array like accessors
Instance Method Summary collapse
-
#[](key) ⇒ Object
Retrieves the object for the passed key.
-
#[]=(key, val) ⇒ Object
Sets the value for a given key and save it right away.
Instance Method Details
#[](key) ⇒ Object
Retrieves the object for the passed key
6 7 8 |
# File 'lib/PackingPeanut-ios/ns_user_defaults.rb', line 6 def [](key) self.objectForKey(key.to_s) end |
#[]=(key, val) ⇒ Object
Sets the value for a given key and save it right away.
11 12 13 14 |
# File 'lib/PackingPeanut-ios/ns_user_defaults.rb', line 11 def []=(key, val) self.setObject(val, forKey: key.to_s) self.synchronize end |