Module: BubbleWrap::Persistence

Defined in:
motion/core/persistence.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) [](key)



15
16
17
# File 'motion/core/persistence.rb', line 15

def [](key)
  storage.objectForKey storage_key(key.to_s)
end

+ (Object) []=(key, value)



10
11
12
13
# File 'motion/core/persistence.rb', line 10

def []=(key, value)
  storage.setObject(value, forKey: storage_key(key.to_s))
  storage.synchronize
end

+ (Object) app_key



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

def app_key
  @app_key ||= BubbleWrap::App.identifier
end

+ (Object) storage



19
20
21
# File 'motion/core/persistence.rb', line 19

def storage
  NSUserDefaults.standardUserDefaults
end

+ (Object) storage_key(key)



23
24
25
# File 'motion/core/persistence.rb', line 23

def storage_key(key)
  app_key + '_' + key.to_s
end