Module: Axn::Configurable::ClassConfigWriter
- Defined in:
- lib/axn/configurable.rb
Overview
Extended onto any class that includes an overrides module (and thus onto every
action via Axn::Configuration.overrides), giving it the namespaced configure
writer. Kept separate from the per-source methods module because configure is
source-agnostic: one method serves every namespace, so extending it twice (a tool
composing several adapters) is idempotent.
Instance Method Summary collapse
-
#axn_configure(namespace = :core) {|writer| ... } ⇒ Object
Sets per-class config for
namespacevia the yielded writer.
Instance Method Details
#axn_configure(namespace = :core) {|writer| ... } ⇒ Object
Sets per-class config for namespace via the yielded writer. No namespace ⇒ :core (axn's
own overridable settings). Always available as axn_configure; configure is the ergonomic
alias installed unless a base class already owns that name (see the overrides include hook).
When the namespace's source is registered on this class (its .overrides were included, so
the schema is known — always true for :core), setter names and values are validated eagerly,
so a typo fails at class definition like the flat setter would. Otherwise the writer is
tolerant: it stores any <setting>= blindly, so a library can pre-declare configure(:mcp) { … }
for an adapter absent from this process — the value sits inert until that adapter resolves it
(and is validated then). Yielded-receiver + assignment mirrors Axn.configure { |c| … }.
409 410 411 412 413 |
# File 'lib/axn/configurable.rb', line 409 def axn_configure(namespace = :core) writer = NamespaceWriter.new(self, namespace) yield(writer) if block_given? writer end |