motion/core/persistence.rb in bubble-wrap-0.4.0 vs motion/core/persistence.rb in bubble-wrap-1.0.0.pre

- old
+ new

@@ -6,17 +6,19 @@ def app_key @app_key ||= BubbleWrap::App.identifier end def []=(key, value) - defaults = NSUserDefaults.standardUserDefaults - defaults.setObject(value, forKey: storage_key(key.to_s)) - defaults.synchronize + storage.setObject(value, forKey: storage_key(key.to_s)) + storage.synchronize end def [](key) - defaults = NSUserDefaults.standardUserDefaults - defaults.objectForKey storage_key(key.to_s) + storage.objectForKey storage_key(key.to_s) + end + + def storage + NSUserDefaults.standardUserDefaults end def storage_key(key) app_key + '_' + key.to_s end