Module: Insika::Plugin
- Defined in:
- lib/insika/plugin.rb,
lib/insika/plugin/loader.rb
Overview
Per-gem boot hook (Railtie style): the plugin gem calls Insika::Plugin.announce(root) when loading its lib/ (before boot); the composition root consumes announced_roots when building the Loader. Explicit and cheap — NO scanning of LOAD_PATH/installed gems.
This file is MINIMAL and dependency-free: third-party gems can load it before anything else from Insika. The Loader lives in plugin/loader.rb (same module, reopened) — this file does NOT require it.
Defined Under Namespace
Classes: Loader
Class Method Summary collapse
-
.announce(root) ⇒ Object
Accumulates roots BEFORE boot, in the gems' require ORDER (that's what defines precedence among gems).
-
.announced_roots ⇒ Object
Frozen copy — nobody mutates the accumulator from outside.
-
.reset_announced! ⇒ Object
TEST support (the accumulator is process state).
Class Method Details
.announce(root) ⇒ Object
Accumulates roots BEFORE boot, in the gems' require ORDER (that's what defines precedence among gems). Dedupes by expanded path.
18 19 20 21 22 |
# File 'lib/insika/plugin.rb', line 18 def announce(root) root = File.(root.to_s) @announced_roots << root unless @announced_roots.include?(root) root end |
.announced_roots ⇒ Object
Frozen copy — nobody mutates the accumulator from outside.
25 26 27 |
# File 'lib/insika/plugin.rb', line 25 def announced_roots @announced_roots.dup.freeze end |
.reset_announced! ⇒ Object
TEST support (the accumulator is process state). Do not use in production.
30 31 32 |
# File 'lib/insika/plugin.rb', line 30 def reset_announced! @announced_roots = [] end |