Class: Textus::Application::Reads::Freshness

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/application/reads/freshness.rb

Overview

Per-entry freshness report. Walks every entry declared in the manifest, consults ‘policies_for(key)` for a refresh policy, and reports the current status. Status is one of :fresh, :stale, :never_refreshed, or :no_policy.

Instance Method Summary collapse

Constructor Details

#initialize(ctx:, evaluator: Textus::Domain::Freshness::Evaluator) ⇒ Freshness

Returns a new instance of Freshness.



11
12
13
14
# File 'lib/textus/application/reads/freshness.rb', line 11

def initialize(ctx:, evaluator: Textus::Domain::Freshness::Evaluator)
  @ctx = ctx
  @evaluator = evaluator
end

Instance Method Details

#call(prefix: nil, zone: nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/textus/application/reads/freshness.rb', line 16

def call(prefix: nil, zone: nil)
  rows = []
  @ctx.store.manifest.entries.each do |mentry|
    next if prefix && !mentry.key.start_with?(prefix)
    next if zone && mentry.zone != zone

    rows << row_for(mentry)
  end
  rows
end