Sha256: e9604b7b2a7d484bfe33e4eef740ac0961a7ce8458dbb7bbfa4d9095e30c2efe
Contents?: true
Size: 681 Bytes
Versions: 1
Compression:
Stored size: 681 Bytes
Contents
require "scorpion/rack/env" module Scorpion module Rack class Middleware ENV_KEY = "scorpion.instance".freeze def initialize( app, nest = nil ) @app = app @nest = nest || Scorpion.instance.build_nest end def call( env ) env[ENV_KEY] = prepare_scorpion( nest.conceive, env ) @app.call(env).tap do free_scorpion( env ) end end private attr_reader :nest def prepare_scorpion( scorpion, env ) scorpion.hunt_for Rack::Env, return: env scorpion end def free_scorpion( env ) env[ENV_KEY].destroy end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scorpion-ioc-1.0.3 | lib/scorpion/rack/middleware.rb |