class Puma::PluginRegistry

def add_background(blk)

def add_background(blk)
  @background << blk
end

def find(name)

def find(name)
  name = name.to_s
  if cls = @plugins[name]
    return cls
  end
  begin
    require "puma/plugin/#{name}"
  rescue LoadError
    raise UnknownPlugin, "Unable to find plugin: #{name}"
  end
  if cls = @plugins[name]
    return cls
  end
  raise UnknownPlugin, "file failed to register a plugin"
end

def fire_background

def fire_background
  @background.each_with_index do |b, i|
    Thread.new do
      Puma.set_thread_name "plgn bg #{i}"
      b.call
    end
  end
end

def initialize

def initialize
  @plugins = {}
  @background = []
end

def register(name, cls)

def register(name, cls)
  @plugins[name] = cls
end