PATH:
opt
/
alt
/
ruby30
/
share
/
gems
/
gems
/
rack-3.0.8
/
lib
/
rack
# frozen_string_literal: true module Rack # Proxy for response bodies allowing calling a block when # the response body is closed (after the response has been fully # sent to the client). class BodyProxy # Set the response body to wrap, and the block to call when the # response has been fully sent. def initialize(body, &block) @body = body @block = block @closed = false end # Return whether the wrapped body responds to the method. def respond_to_missing?(method_name, include_all = false) super or @body.respond_to?(method_name, include_all) end # If not already closed, close the wrapped body and # then call the block the proxy was initialized with. def close return if @closed @closed = true begin @body.close if @body.respond_to?(:close) ensure @block.call end end # Whether the proxy is closed. The proxy starts as not closed, # and becomes closed on the first call to close. def closed? @closed end # Delegate missing methods to the wrapped body. def method_missing(method_name, *args, &block) @body.__send__(method_name, *args, &block) end # :nocov: ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true) # :nocov: end end
[+]
auth
[-] common_logger.rb
[edit]
[-] rewindable_input.rb
[edit]
[-] deflater.rb
[edit]
[-] tempfile_reaper.rb
[edit]
[-] directory.rb
[edit]
[-] utils.rb
[edit]
[+]
multipart
[-] builder.rb
[edit]
[-] response.rb
[edit]
[-] conditional_get.rb
[edit]
[-] version.rb
[edit]
[-] request.rb
[edit]
[-] show_status.rb
[edit]
[-] mock_request.rb
[edit]
[-] method_override.rb
[edit]
[-] head.rb
[edit]
[-] logger.rb
[edit]
[-] static.rb
[edit]
[-] mock.rb
[edit]
[-] chunked.rb
[edit]
[-] runtime.rb
[edit]
[-] urlmap.rb
[edit]
[-] null_logger.rb
[edit]
[-] files.rb
[edit]
[-] query_parser.rb
[edit]
[-] mock_response.rb
[edit]
[+]
..
[-] show_exceptions.rb
[edit]
[-] mime.rb
[edit]
[-] config.rb
[edit]
[-] constants.rb
[edit]
[-] events.rb
[edit]
[-] lint.rb
[edit]
[-] content_type.rb
[edit]
[-] reloader.rb
[edit]
[-] recursive.rb
[edit]
[-] multipart.rb
[edit]
[-] body_proxy.rb
[edit]
[-] sendfile.rb
[edit]
[-] etag.rb
[edit]
[-] headers.rb
[edit]
[-] cascade.rb
[edit]
[-] file.rb
[edit]
[-] lock.rb
[edit]
[-] media_type.rb
[edit]
[-] content_length.rb
[edit]