Class: Datadog::DI::ProcResponder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/di/proc_responder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

An adapter to convert procs to responders.

Used in test suite and benchmarks.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(executed_proc, failed_proc = nil) ⇒ ProcResponder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ProcResponder.



11
12
13
14
# File 'lib/datadog/di/proc_responder.rb', line 11

def initialize(executed_proc, failed_proc = nil)
  @executed_proc = executed_proc
  @failed_proc = failed_proc
end

Instance Attribute Details

#executed_procObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
# File 'lib/datadog/di/proc_responder.rb', line 16

def executed_proc
  @executed_proc
end

#failed_procObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
# File 'lib/datadog/di/proc_responder.rb', line 17

def failed_proc
  @failed_proc
end

Instance Method Details

#probe_condition_evaluation_failed_callback(context, exc) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
27
28
29
# File 'lib/datadog/di/proc_responder.rb', line 23

def probe_condition_evaluation_failed_callback(context, exc)
  if failed_proc.nil?
    raise NotImplementedError, "Failed proc not provided"
  end

  failed_proc.call(context, exc)
end

#probe_executed_callback(context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/datadog/di/proc_responder.rb', line 19

def probe_executed_callback(context)
  executed_proc.call(context)
end