Class: TwiAuth::Store
- Inherits:
-
Object
- Object
- TwiAuth::Store
- Defined in:
- lib/twiauth/store.rb
Overview
A simple key value store using PStore, provided by ruby
Constant Summary collapse
- DATA_FILE =
Filename for pstore data file
"data.pstore"
Instance Method Summary collapse
-
#delete(key) ⇒ Object
delete a key.
-
#get(key) ⇒ Object
get the value of the key.
-
#initialize ⇒ Store
constructor
:nodoc:.
-
#put(key, value) ⇒ Object
put a key with value.
Constructor Details
Instance Method Details
#delete(key) ⇒ Object
delete a key
29 30 31 32 33 |
# File 'lib/twiauth/store.rb', line 29 def delete(key) @store.transaction do @store.delete(key) end end |
#get(key) ⇒ Object
get the value of the key
21 22 23 24 25 26 |
# File 'lib/twiauth/store.rb', line 21 def get(key) @store.transaction do @value = @store[key] end @value end |
#put(key, value) ⇒ Object
put a key with value
14 15 16 17 18 |
# File 'lib/twiauth/store.rb', line 14 def put(key, value) @store.transaction do @store[key] = value end end |