Lookback

Historical record management for Ruby. Under active development — the public API may change until a 1.0 release.

Lookback records and reads versions of application state. The 0.0.x line ships a working in-memory snapshot backend and the public API surface intended to cover future backends:

  • Native snapshot store (persistent) — planned
  • Ruby PaperTrail adapter — planned
  • Hibernate Envers adapter (over shared datastores) — planned

Usage

require "lookback"

Lookback.track("Order", 42, { status: "pending" }, event: :create)
Lookback.track("Order", 42, { status: "paid"    }, event: :update)

Lookback.history("Order", 42).map(&:event)   # => [:create, :update]
Lookback.latest("Order", 42).attributes      # => { status: "paid" }

Swap the backend by assigning Lookback.backend = MyBackend.new. A backend implements #record(key, attributes, event:, now:), #history(key), and #latest(key).

License

MIT. See LICENSE.txt.