Class: Blobby::LoggingStore::StoredObject
- Inherits:
-
Object
- Object
- Blobby::LoggingStore::StoredObject
- Defined in:
- lib/blobby/logging_store.rb
Overview
Represents an object in the store.
Instance Method Summary collapse
- #delete ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(object, callbacks = {}) ⇒ StoredObject
constructor
A new instance of StoredObject.
- #read(&block) ⇒ Object
- #write(*args) ⇒ Object
Constructor Details
#initialize(object, callbacks = {}) ⇒ StoredObject
Returns a new instance of StoredObject.
36 37 38 39 40 |
# File 'lib/blobby/logging_store.rb', line 36 def initialize(object, callbacks = {}) @object = object @on_write = callbacks[:on_write] || -> {} @on_delete = callbacks[:on_delete] || -> {} end |
Instance Method Details
#delete ⇒ Object
56 57 58 59 60 |
# File 'lib/blobby/logging_store.rb', line 56 def delete deleted = @object.delete @on_delete.call if deleted deleted end |
#exists? ⇒ Boolean
42 43 44 |
# File 'lib/blobby/logging_store.rb', line 42 def exists? @object.exists? end |
#read(&block) ⇒ Object
46 47 48 |
# File 'lib/blobby/logging_store.rb', line 46 def read(&block) @object.read(&block) end |
#write(*args) ⇒ Object
50 51 52 53 54 |
# File 'lib/blobby/logging_store.rb', line 50 def write(*args) @object.write(*args) @on_write.call nil end |