Module: ReverseProxy::Patch::Puma

Defined in:
lib/reverse_proxy/patch/puma.rb

Defined Under Namespace

Modules: DSL

Class Method Summary collapse

Class Method Details

.patchObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/reverse_proxy/patch/puma.rb', line 28

def self.patch
  require "puma/configuration" rescue return
  require "puma/dsl" rescue return
  require "puma/cluster" rescue return
  ::Puma::DSL.send :include, ReverseProxy::Patch::Puma::DSL
  # FIXME: This is a really ugly hack to receive events while the app is running
  ::Puma::Cluster::Worker.send :remove_method, :booted?
  ::Puma::Cluster::Worker.send :define_method, :booted? do
    ::ReverseProxy.instance.send :"on_#{@stage}" if @stage == :booted
    @stage == :booted
  end
end