Sha256: 428b201bc75b7fbafbdb65aee8ac0e7fb96c8c1e8bd1846265922c9bc94fc5ac

Contents?: true

Size: 525 Bytes

Versions: 41

Compression:

Stored size: 525 Bytes

Contents

module Datadog
  class Registry
    # Registerable provides a convenience method for self-registering
    module Registerable
      def self.included(base)
        base.singleton_class.send(:include, ClassMethods)
      end

      # ClassMethods
      module ClassMethods
        def register_as(name, options = {})
          registry = options.fetch(:registry, Datadog.registry)
          auto_patch = options.fetch(:auto_patch, false)

          registry.add(name, self, auto_patch)
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
ddtrace-0.10.0 lib/ddtrace/registry/registerable.rb