Class: Datadog::Tracing::Contrib::Registry
- Inherits:
-
Object
- Object
- Datadog::Tracing::Contrib::Registry
- Includes:
- Enumerable
- Defined in:
- lib/datadog/tracing/contrib/registry.rb
Overview
Registry is a collection of tracing integrations.
Defined Under Namespace
Classes: Entry
Instance Method Summary collapse
- #[](name) ⇒ Object
- #add(name, klass, auto_patch = false) ⇒ Object
- #each(&block) ⇒ Object
- #to_h ⇒ Object
Instance Method Details
#[](name) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/datadog/tracing/contrib/registry.rb', line 35 def [](name) @mutex.synchronize do entry = @data[name] entry.klass if entry end end |
#add(name, klass, auto_patch = false) ⇒ Object
23 24 25 26 27 |
# File 'lib/datadog/tracing/contrib/registry.rb', line 23 def add(name, klass, auto_patch = false) @mutex.synchronize do @data[name] = Entry.new(name, klass, auto_patch).freeze end end |
#each(&block) ⇒ Object
29 30 31 32 33 |
# File 'lib/datadog/tracing/contrib/registry.rb', line 29 def each(&block) @mutex.synchronize do @data.each_value(&block) end end |
#to_h ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/datadog/tracing/contrib/registry.rb', line 42 def to_h @mutex.synchronize do @data.each_with_object({}) do |(_, entry), hash| hash[entry.name] = entry.auto_patch end end end |