Class: KeySet

Inherits:
Set
  • Object
show all
Defined in:
lib/keyset.rb

Instance Method Summary collapse

Constructor Details

#initialize(store, store_key) ⇒ KeySet

Returns a new instance of KeySet.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/keyset.rb', line 4

def initialize(store, store_key)
  @store = store
  @store_key = store_key


  if existing=@store.send(:read_entry, @store_key, {})
    super(YAML.load(existing.value))
  else
    super([])
  end

end

Instance Method Details

#add_with_cache(value) ⇒ Object



17
18
19
20
21
# File 'lib/keyset.rb', line 17

def add_with_cache(value)
  add_without_cache(value)
ensure
  store
end

#clear_with_cacheObject



33
34
35
36
37
# File 'lib/keyset.rb', line 33

def clear_with_cache
  clear_without_cache
ensure
  store
end

#delete_with_cache(value) ⇒ Object



25
26
27
28
29
# File 'lib/keyset.rb', line 25

def delete_with_cache(value)
  delete_without_cache(value)
ensure
  store 
end