Class: Puma::PluginLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/puma/plugin.rb

Instance Method Summary collapse

Constructor Details

#initializePluginLoader

Returns a new instance of PluginLoader.


7
8
9
# File 'lib/puma/plugin.rb', line 7

def initialize
  @instances = []
end

Instance Method Details

#create(name) ⇒ Object

Raises:


11
12
13
14
15
16
17
18
19
# File 'lib/puma/plugin.rb', line 11

def create(name)
  if cls = Plugins.find(name)
    plugin = cls.new
    @instances << plugin
    return plugin
  end

  raise UnknownPlugin, "File failed to register properly named plugin"
end

#fire_starts(launcher) ⇒ Object


21
22
23
24
25
26
27
# File 'lib/puma/plugin.rb', line 21

def fire_starts(launcher)
  @instances.each do |i|
    if i.respond_to? :start
      i.start(launcher)
    end
  end
end