Class: Datadog::Core::Remote::Dispatcher
- Inherits:
-
Object
- Object
- Datadog::Core::Remote::Dispatcher
- Defined in:
- lib/datadog/core/remote/dispatcher.rb
Overview
Repository update dispatcher
Defined Under Namespace
Instance Attribute Summary collapse
-
#receivers ⇒ Object
readonly
Returns the value of attribute receivers.
Instance Method Summary collapse
- #dispatch(changes, repository) ⇒ Object
-
#initialize(receivers) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
Constructor Details
#initialize(receivers) ⇒ Dispatcher
Returns a new instance of Dispatcher.
10 11 12 |
# File 'lib/datadog/core/remote/dispatcher.rb', line 10 def initialize(receivers) @receivers = receivers end |
Instance Attribute Details
#receivers ⇒ Object (readonly)
Returns the value of attribute receivers.
8 9 10 |
# File 'lib/datadog/core/remote/dispatcher.rb', line 8 def receivers @receivers end |
Instance Method Details
#dispatch(changes, repository) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/datadog/core/remote/dispatcher.rb', line 14 def dispatch(changes, repository) receivers.each do |receiver| matching_changes = changes.select { |c| receiver.match?(c.path) } receiver.call(repository, matching_changes) if matching_changes.any? end end |