Sha256: 6cac628cc1ef11747b5af74ae94197631c1b19b2924abfc5f6a42c4bb02d5464
Contents?: true
Size: 879 Bytes
Versions: 43
Compression:
Stored size: 879 Bytes
Contents
module Datadog module Contrib # Registry is a collection of integrations. class Registry include Enumerable Entry = Struct.new(:name, :klass, :auto_patch) def initialize @data = {} @mutex = Mutex.new end def add(name, klass, auto_patch = false) @mutex.synchronize do @data[name] = Entry.new(name, klass, auto_patch).freeze end end def each @mutex.synchronize do @data.each { |_, entry| yield(entry) } end end def [](name) @mutex.synchronize do entry = @data[name] entry.klass if entry end end def to_h @mutex.synchronize do @data.each_with_object({}) do |(_, entry), hash| hash[entry.name] = entry.auto_patch end end end end end end
Version data entries
43 entries across 43 versions & 2 rubygems