Module: Pikuri::Agent::Event::Transient

Defined in:
lib/pikuri/agent/event.rb

Overview

Marks a domain event whose successor replaces it rather than adding to a log: an indexing bar, a download percentage. A chrome that can rewrite a line does; one that cannot shows only the final state.

Progress = Data.define(:title, :done) do
include Pikuri::Agent::Event::Transient
def to_s = done ? "#{title} — done" : title
end

The contract is two methods, both of which a Data.define already answers: #to_s is the whole rendering — a listener never inspects the fields, which is what keeps core ignorant of a gem's payload — and #done says the sequence is over and its line may go away.