class Puma::Plugin - puma-3.10.0 Documentation

# class Puma::Plugin

### Constants

CALLER_FILE

  Matches

      "C:/Ruby22/lib/ruby/gems/2.2.0/gems/puma-3.0.1/lib/puma/plugin/tmp_restart.rb:3:in `<top (required)>'"
      AS
      C:/Ruby22/lib/ruby/gems/2.2.0/gems/puma-3.0.1/lib/puma/plugin/tmp_restart.rb

### Public Class Methods

create(&blk) click to toggle source

    # File lib/puma/plugin.rb, line 92
    def self.create(&blk)
      name = extract_name(caller)

      cls = Class.new(self)

      cls.class_eval(&blk)

      Plugins.register name, cls
    end

extract_name(ary) click to toggle source

    # File lib/puma/plugin.rb, line 85
    def self.extract_name(ary)
      path = ary.first[CALLER_FILE]

      m = %r!puma/plugin/([^/]*)\.rb$!.match(path)
      return m[1]
    end

new(loader) click to toggle source

    # File lib/puma/plugin.rb, line 102
    def initialize(loader)
      @loader = loader
    end

### Public Instance Methods

in_background(&blk) click to toggle source

    # File lib/puma/plugin.rb, line 106
    def in_background(&blk)
      Plugins.add_background blk
    end

workers_supported?() click to toggle source

    # File lib/puma/plugin.rb, line 110
    def workers_supported?
      return false if Puma.jruby? || Puma.windows?
      true
    end