Sha256: 4ed24488c970512ce59168e9cf72e4f9a16fb96657fb4104d7bbfdf469046ad8
Contents?: true
Size: 759 Bytes
Versions: 10
Compression:
Stored size: 759 Bytes
Contents
module Toy module Middleware class IdentityMap class Body def initialize(target, original) @target = target @original = original end def each(&block) @target.each(&block) end def close @target.close if @target.respond_to?(:close) ensure Toy::IdentityMap.enabled = @original Toy::IdentityMap.clear end end def initialize(app) @app = app end def call(env) Toy::IdentityMap.clear enabled = Toy::IdentityMap.enabled Toy::IdentityMap.enabled = true status, headers, body = @app.call(env) [status, headers, Body.new(body, enabled)] end end end end
Version data entries
10 entries across 10 versions & 1 rubygems