Class: Insika::ContextProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/insika/context/provider.rb

Overview

Base class for a context provider. Concrete subclasses live in Insika::Context::Providers. The base is deliberately minimal: required? lives on the provider, not the wiring.

Instance Method Summary collapse

Instance Method Details

#call(_request) ⇒ Object

-> [ContextFragment]; may do IO



11
12
13
14
15
# File 'lib/insika/context/provider.rb', line 11

def call(_request) = []        # -> [ContextFragment]; may do IO
# which cache layer the output belongs to.
#   :identity -> changes only on deploy/config edit (the cacheable prefix);
#   :volatile -> may change per turn (the Builder renders identity first).
# :volatile is the conservative default — nothing gets pinned by accident.

#enabled_for?(_profile) ⇒ Boolean

Returns:

  • (Boolean)


10
# File 'lib/insika/context/provider.rb', line 10

def enabled_for?(_profile) = true

#idObject

override for a stable name



8
# File 'lib/insika/context/provider.rb', line 8

def id = self.class.name       # override for a stable name

#layerObject

which cache layer the output belongs to. :identity -> changes only on deploy/config edit (the cacheable prefix); :volatile -> may change per turn (the Builder renders identity first). :volatile is the conservative default — nothing gets pinned by accident.



16
# File 'lib/insika/context/provider.rb', line 16

def layer = :volatile

#required?Boolean

true -> failure aborts the turn

Returns:

  • (Boolean)


9
# File 'lib/insika/context/provider.rb', line 9

def required? = false          # true -> failure aborts the turn