Class: Raindrops::Middleware::Proxy

### Home Classes Methods

### In Files

- lib/raindrops/middleware/proxy.rb

### Parent

Object

### Methods

- ::new
- #close
- #each
- #method_missing
- #respond_to?
- #to_path

### Files

- LICENSE
- NEWS
- README

### Class/Module Index

Quicksearch

- Raindrops
- Raindrops::Aggregate
- Raindrops::Aggregate::LastDataRecv
- Raindrops::Aggregate::PMQ
- Raindrops::InetDiagSocket
- Raindrops::LastDataRecv
- Raindrops::Linux
- Raindrops::ListenStats
- Raindrops::Middleware
- Raindrops::Middleware::Proxy
- Raindrops::Middleware::Stats
- Raindrops::Struct
- Raindrops::TCP_Info
- Raindrops::Watcher

No matching classes.

# Raindrops::Middleware::Proxy

This class is used by Raindrops::Middleware to proxy application response bodies. There should be no need to use it directly.

### Public Class Methods

new(body, stats) click to toggle source

    # File lib/raindrops/middleware/proxy.rb, line 5
    def initialize(body, stats)
      @body, @stats = body, stats
    end

### Public Instance Methods

close() click to toggle source

the Rack server should call this after each (usually ensure-d)

    # File lib/raindrops/middleware/proxy.rb, line 15
    def close
      @stats.decr_writing
      @body.close if @body.respond_to?(:close)
    end

each() click to toggle source

yield to the Rack server here for writing

    # File lib/raindrops/middleware/proxy.rb, line 10
    def each
      @body.each { |x| yield x }
    end

method_missing(*args, &block) click to toggle source

Avoid breaking users of non-standard extensions (e.g. body) Rack::BodyProxy does the same.

    # File lib/raindrops/middleware/proxy.rb, line 36
    def method_missing(*args, &block)
      @body.__send__(*args, &block)
    end

respond_to?(m) click to toggle source

Rack servers use `respond_to?` to check for the presence of `close` and `to_path` methods.

    # File lib/raindrops/middleware/proxy.rb, line 29
    def respond_to?(m)
      m = m.to_sym
      :close == m || @body.respond_to?(m)
    end

to_path() click to toggle source

Some Rack servers can optimize response processing if it responds to `to_path` via the sendfile(2) system call, we proxy `to_path` to the underlying body if possible.

    # File lib/raindrops/middleware/proxy.rb, line 23
    def to_path
      @body.to_path
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.