Module: Joggle::Store::PStore::Message
- Included in:
- All
- Defined in:
- lib/joggle/store/pstore/message.rb
Overview
Mixin that implements message store methods for pstore objects
Note: You’re probably looking for Joggle::Store::PStore::All
Instance Method Summary collapse
-
#add_message(key, row) ⇒ Object
Add message to store.
-
#delete_message(key) ⇒ Object
Delete the given message.
-
#has_message?(key) ⇒ Boolean
Does the given message exist in this store?.
-
#message_store_key(key) ⇒ Object
Map given key to PStore root key.
Instance Method Details
#add_message(key, row) ⇒ Object
Add message to store.
15 16 17 18 19 20 21 |
# File 'lib/joggle/store/pstore/message.rb', line 15 def (key, row) key = (key) @store.transaction do |s| s[key] = row end end |
#delete_message(key) ⇒ Object
Delete the given message.
37 38 39 40 41 42 43 |
# File 'lib/joggle/store/pstore/message.rb', line 37 def (key) key = (key) @store.transaction do |s| s.delete(key) end end |
#has_message?(key) ⇒ Boolean
Does the given message exist in this store?
26 27 28 29 30 31 32 |
# File 'lib/joggle/store/pstore/message.rb', line 26 def (key) key = (key) @store.transaction(true) do |s| s.root?(key) end end |
#message_store_key(key) ⇒ Object
Map given key to PStore root key.
48 49 50 |
# File 'lib/joggle/store/pstore/message.rb', line 48 def (key) 'message-' << Digest::MD5.hexdigest(key.to_s) end |