Class: Napa::Ext::Poison::PoisonHandler

Inherits:
Rack::Auth::Basic
  • Object
show all
Defined in:
lib/napa/ext/poison.rb

Constant Summary collapse

MESSY_CONTAGION_CMD =
%(
  for i in
    `ps aux | grep unicorn | grep -v grep | tr -s ' ' | cut -d' ' -f2`;
    do kill -15 $i;
  done
).gsub(/\s+/, ' ')

Instance Method Summary collapse

Constructor Details

#initialize(pill) ⇒ PoisonHandler

Returns a new instance of PoisonHandler.



44
45
46
# File 'lib/napa/ext/poison.rb', line 44

def initialize pill
  @pill = pill.to_sym
end

Instance Method Details

#call(_) ⇒ Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/napa/ext/poison.rb', line 48

def call _
  case pill
  when :normal
    exit 0
  when :nohandle
    exit! 1
  when :messy_contagion
    system MESSY_CONTAGION_CMD
  end
end