Class: Collavre::IntegrationRegistry
- Inherits:
-
Object
- Object
- Collavre::IntegrationRegistry
- Includes:
- Singleton
- Defined in:
- lib/collavre/integration_registry.rb
Overview
Registry for third-party integrations (Slack, GitHub, Notion, etc.) Allows extensions to register themselves and provide UI components without modifying the core Collavre engine.
Instance Method Summary collapse
-
#all ⇒ Object
Get all registered integrations.
-
#any? ⇒ Boolean
Check if any integrations are registered.
-
#each(&block) ⇒ Object
Iterate over all integrations.
-
#find(name) ⇒ Object
Get a specific integration by name.
-
#initialize ⇒ IntegrationRegistry
constructor
A new instance of IntegrationRegistry.
-
#register(name, config) ⇒ Object
Register a new integration.
-
#reset! ⇒ Object
Clear all integrations (useful for testing).
-
#unregister(name) ⇒ Object
Unregister an integration.
Constructor Details
#initialize ⇒ IntegrationRegistry
Returns a new instance of IntegrationRegistry.
21 22 23 24 |
# File 'lib/collavre/integration_registry.rb', line 21 def initialize @integrations = {} @mutex = Mutex.new end |
Instance Method Details
#all ⇒ Object
Get all registered integrations
60 61 62 63 64 |
# File 'lib/collavre/integration_registry.rb', line 60 def all @mutex.synchronize do @integrations.values end end |
#any? ⇒ Boolean
Check if any integrations are registered
72 73 74 75 76 |
# File 'lib/collavre/integration_registry.rb', line 72 def any? @mutex.synchronize do @integrations.any? end end |
#each(&block) ⇒ Object
Iterate over all integrations
67 68 69 |
# File 'lib/collavre/integration_registry.rb', line 67 def each(&block) all.each(&block) end |
#find(name) ⇒ Object
Get a specific integration by name
53 54 55 56 57 |
# File 'lib/collavre/integration_registry.rb', line 53 def find(name) @mutex.synchronize do @integrations[name.to_sym] end end |
#register(name, config) ⇒ Object
Register a new integration
36 37 38 39 40 41 42 43 |
# File 'lib/collavre/integration_registry.rb', line 36 def register(name, config) integration = Integration.new(name, config) @mutex.synchronize do @integrations[name.to_sym] = integration end Rails.logger.info("[Collavre] Integration registered: #{name}") integration end |
#reset! ⇒ Object
Clear all integrations (useful for testing)
79 80 81 82 83 |
# File 'lib/collavre/integration_registry.rb', line 79 def reset! @mutex.synchronize do @integrations = {} end end |
#unregister(name) ⇒ Object
Unregister an integration
46 47 48 49 50 |
# File 'lib/collavre/integration_registry.rb', line 46 def unregister(name) @mutex.synchronize do @integrations.delete(name.to_sym) end end |