Class: Jazari::Run

Inherits:
ApplicationRecord show all
Defined in:
app/models/jazari/run.rb

Overview

One execution of a ritual. The layer that makes "did last night's run actually complete?" a query instead of a guess.

Immutable once closed. Ticks on a run never touch the subject's checklist — that separation is the whole point: reset on a runbook must not be able to destroy the record that the ritual ever ran.

Constant Summary collapse

OUTCOMES =
%w[completed abandoned failed].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.table_nameObject

Resolved on EVERY call, not assigned at class-definition time.

Assigning it eagerly made the binding depend on load order: under Zeitwerk a host's configure runs before these constants autoload, so the assignment never happened and the model silently kept the gem's default name. A host adopting existing tables then queried tables that do not exist. Reading config here removes the ordering question entirely.



18
# File 'app/models/jazari/run.rb', line 18

def self.table_name = Jazari.table_name_for(:runs)

Instance Method Details

#closed?Boolean

Returns:

  • (Boolean)


33
# File 'app/models/jazari/run.rb', line 33

def closed? = !open?

#open?Boolean

Returns:

  • (Boolean)


32
# File 'app/models/jazari/run.rb', line 32

def open?   = finished_at.nil?