Class: Helu::LocalStorage
- Inherits:
-
Object
- Object
- Helu::LocalStorage
- Defined in:
- lib/project/helu.rb
Instance Method Summary collapse
Instance Method Details
#add(product_id) ⇒ Object
97 98 99 100 101 102 103 104 105 |
# File 'lib/project/helu.rb', line 97 def add(product_id) if all defaults.setObject([all, product_id].flatten, forKey: key_for_defaults) else defaults.setObject([product_id], forKey: key_for_defaults) end defaults.synchronize end |
#all ⇒ Object
107 108 109 110 |
# File 'lib/project/helu.rb', line 107 def all return [] if defaults.valueForKey(key_for_defaults) == nil defaults.valueForKey(key_for_defaults) end |
#clean ⇒ Object
92 93 94 95 |
# File 'lib/project/helu.rb', line 92 def clean defaults.setObject(nil, forKey: key_for_defaults) defaults.synchronize end |