Module: Mammoth::Destinations::Registry
- Defined in:
- lib/mammoth/destinations/registry.rb
Overview
Registry for destination adapters.
Class Method Summary collapse
-
.build(destination, label:) ⇒ Object
Build a destination sink from config.
-
.fetch(name) ⇒ Object
Fetch a destination adapter.
-
.names ⇒ Array<String>
Registered destination adapter names.
-
.register(name, adapter) ⇒ Object
Register a destination adapter.
-
.registry ⇒ Mammoth::Registry
Underlying registry.
Class Method Details
.build(destination, label:) ⇒ Object
Build a destination sink from config.
30 31 32 |
# File 'lib/mammoth/destinations/registry.rb', line 30 def build(destination, label:) fetch(destination.fetch("type", "webhook")).build(destination, label: label) end |
.fetch(name) ⇒ Object
Fetch a destination adapter.
21 22 23 |
# File 'lib/mammoth/destinations/registry.rb', line 21 def fetch(name) registry.fetch(name) end |
.names ⇒ Array<String>
Returns registered destination adapter names.
35 36 37 |
# File 'lib/mammoth/destinations/registry.rb', line 35 def names registry.names end |
.register(name, adapter) ⇒ Object
Register a destination adapter.
13 14 15 |
# File 'lib/mammoth/destinations/registry.rb', line 13 def register(name, adapter) registry.register(name, adapter) end |
.registry ⇒ Mammoth::Registry
Returns underlying registry.
40 41 42 |
# File 'lib/mammoth/destinations/registry.rb', line 40 def registry @registry ||= Mammoth::Registry.new("destination") end |