Class: Rack::LambdaApp

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/lambda_app.rb

Instance Method Summary collapse

Constructor Details

#initialize(proc) ⇒ LambdaApp

LambdaApp.new returns itself, which has a new method so it can be used like normal middleware.



12
13
14
# File 'lib/rack/lambda_app.rb', line 12

def initialize(proc)
  @proc = proc
end

Instance Method Details

#call(env) ⇒ Object



21
22
23
24
25
# File 'lib/rack/lambda_app.rb', line 21

def call(env)
  result = @proc.call(env)
  return result if result
  return @app.call(env)
end

#new(app) ⇒ Object



16
17
18
19
# File 'lib/rack/lambda_app.rb', line 16

def new(app)
  @app = app
  return self
end