Class: Airfoil::Middleware::FunctionName

Inherits:
Base
  • Object
show all
Defined in:
lib/airfoil/middleware/function_name.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, handler_class, *function_names_to_match) ⇒ FunctionName

Returns a new instance of FunctionName.



6
7
8
9
10
# File 'lib/airfoil/middleware/function_name.rb', line 6

def initialize(app, handler_class, *function_names_to_match)
  super(app)
  @handler_class = handler_class
  @function_names_to_match = function_names_to_match
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/airfoil/middleware/function_name.rb', line 12

def call(env)
  context = env[:context]

  if handles? context
    @handler_class.handle(env[:event], context)
  else
    @app.call(env)
  end
end