Class: Textus::Application::Writes::Delete
- Inherits:
-
Object
- Object
- Textus::Application::Writes::Delete
- Defined in:
- lib/textus/application/writes/delete.rb
Instance Method Summary collapse
- #call(key, if_etag: nil, suppress_events: false) ⇒ Object
-
#initialize(ctx:, envelope_io:) ⇒ Delete
constructor
A new instance of Delete.
Constructor Details
#initialize(ctx:, envelope_io:) ⇒ Delete
Returns a new instance of Delete.
5 6 7 8 |
# File 'lib/textus/application/writes/delete.rb', line 5 def initialize(ctx:, envelope_io:) @ctx = ctx @envelope_io = envelope_io end |
Instance Method Details
#call(key, if_etag: nil, suppress_events: false) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/textus/application/writes/delete.rb', line 10 def call(key, if_etag: nil, suppress_events: false) @ctx.manifest.validate_key!(key) mentry = @ctx.manifest.resolve(key).entry @ctx.(mentry) @envelope_io.delete(key, mentry: mentry, if_etag: if_etag) unless suppress_events @ctx.bus.publish(:entry_deleted, store: @ctx.with_role(@ctx.role), key: key, correlation_id: @ctx.correlation_id) end { "protocol" => Textus::PROTOCOL, "ok" => true, "key" => key, "deleted" => true } end |