Class: Groovy::MemoryPoolMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/groovy/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ MemoryPoolMiddleware

Returns a new instance of MemoryPoolMiddleware.



3
4
5
# File 'lib/groovy/middleware.rb', line 3

def initialize(app, options = {})
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
# File 'lib/groovy/middleware.rb', line 7

def call(env)
  Groovy.contexts.each { |name, ctx| ctx.push_memory_pool }
  @app.call(env)
ensure
  Groovy.contexts.each { |name, ctx| ctx.pop_memory_pool }
end