Class: Datadog::Core::Remote::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/core/remote/dispatcher.rb

Overview

Repository update dispatcher

Defined Under Namespace

Classes: Matcher, Receiver

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDispatcher

Returns a new instance of Dispatcher.



10
11
12
# File 'lib/datadog/core/remote/dispatcher.rb', line 10

def initialize
  @receivers = []
end

Instance Attribute Details

#receiversObject (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