class Puma::PluginRegistry - puma-3.10.0 Documentation

# class Puma::PluginRegistry

### Public Class Methods

new() click to toggle source

    # File lib/puma/plugin.rb, line 29
    def initialize
      @plugins = {}
      @background = []
    end

### Public Instance Methods

add_background(blk) click to toggle source

    # File lib/puma/plugin.rb, line 58
    def add_background(blk)
      @background << blk
    end

find(name) click to toggle source

    # File lib/puma/plugin.rb, line 38
    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

fire_background() click to toggle source

    # File lib/puma/plugin.rb, line 62
    def fire_background
      @background.each do |b|
        Thread.new(&b)
      end
    end

register(name, cls) click to toggle source

    # File lib/puma/plugin.rb, line 34
    def register(name, cls)
      @plugins[name] = cls
    end