Module: Plutonium::Migrations
- Defined in:
- lib/plutonium/migrations.rb
Overview
Registry of per-feature migration paths.
Features register their migration directory against a configuration key. A
path is only surfaced by Migrations.enabled_paths when its feature's config
(+Plutonium.configuration..enabled and it is true.
Class Method Summary collapse
-
.enabled_paths ⇒ Array<String>
Migration paths for features that are currently enabled.
-
.register(feature, path) ⇒ String
Register a migration path for a feature.
-
.reset! ⇒ Hash
Clear the registry.
Class Method Details
.enabled_paths ⇒ Array<String>
Migration paths for features that are currently enabled.
32 33 34 35 36 37 |
# File 'lib/plutonium/migrations.rb', line 32 def enabled_paths @registry.filter_map do |feature, path| cfg = Plutonium.configuration.public_send(feature) if Plutonium.configuration.respond_to?(feature) path if cfg&.respond_to?(:enabled) && cfg.enabled end end |
.register(feature, path) ⇒ String
Register a migration path for a feature.
18 19 20 |
# File 'lib/plutonium/migrations.rb', line 18 def register(feature, path) @registry[feature.to_sym] = path end |
.reset! ⇒ Hash
Clear the registry. Intended for tests.
25 26 27 |
# File 'lib/plutonium/migrations.rb', line 25 def reset! @registry = {} end |