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

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

Overview

Store Matcher and block to be executed on a match

Instance Method Summary collapse

Constructor Details

#initialize(matcher, initial_reconcile: false, &block) ⇒ Receiver

Returns a new instance of Receiver.



56
57
58
59
60
# File 'lib/datadog/core/remote/dispatcher.rb', line 56

def initialize(matcher, initial_reconcile: false, &block)
  @block = block
  @initial_reconcile = initial_reconcile
  @matcher = matcher
end

Instance Method Details

#call(repository, changes) ⇒ Object



74
75
76
# File 'lib/datadog/core/remote/dispatcher.rb', line 74

def call(repository, changes)
  @block.call(repository, changes)
end

#initial_reconcile? ⇒ Boolean

Whether #reconcile may call this receiver with an empty change list on the client's first sync. A participating receiver must act on the repository's current contents when the change list is empty.

Returns:

  • (Boolean)


70
71
72
# File 'lib/datadog/core/remote/dispatcher.rb', line 70

def initial_reconcile?
  @initial_reconcile
end

#match?(path) ⇒ Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/datadog/core/remote/dispatcher.rb', line 62

def match?(path)
  @matcher.match?(path)
end