Class: Napa::Ext::Poison

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

Defined Under Namespace

Classes: PoisonHandler

Constant Summary collapse

MATCHER =
%r{\A/poison/(?<pill>normal|nohandle|messy_contagion)\z}

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Poison

Returns a new instance of Poison.



6
7
8
# File 'lib/napa/ext/poison.rb', line 6

def initialize app
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/napa/ext/poison.rb', line 10

def call env
  pill = pill_from env
  if pill
    handler_for(pill).call env
  else
    app.call env
  end
end