Class: ActiveSanction::ValidatorStore::Memory

Inherits:
ValidatorStore
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/active_sanction/validator_store/memory.rb

Overview

Validators for the life of one process, and no longer.

The default for a caller that builds its own client and does not want a file appearing under a home directory, and what the suite uses so an example never depends on -- or leaves behind -- state on disk. A long-running process that syncs on a schedule still gets the whole benefit of conditional GET from it; only a fresh boot pays for a full download.

Instance Method Summary collapse

Constructor Details

#initialize(entries = {}) ⇒ void

Parameters:

  • entries (Hash{T.untyped => Validators, nil}) (defaults to: {})


20
21
22
23
24
25
# File 'lib/active_sanction/validator_store/memory.rb', line 20

def initialize(entries = {})
  @entries = T.let({}, T::Hash[String, Validators])
  @mutex = T.let(Mutex.new, Mutex)
  entries.each { |key, validators| self[key] = validators }
  super()
end