In Files

Parent

Methods

Class Index [+]

Quicksearch

Rack::ETag

Automatically sets the ETag header on all String bodies

Public Class Methods

new(app) click to toggle source

(Not documented)

   # File lib/rack/etag.rb, line 6
6:     def initialize(app)
7:       @app = app
8:     end

Public Instance Methods

call(env) click to toggle source

(Not documented)

    # File lib/rack/etag.rb, line 10
10:     def call(env)
11:       status, headers, body = @app.call(env)
12: 
13:       if !headers.has_key?('ETag')
14:         parts = []
15:         body.each { |part| parts << part.to_s }
16:         headers['ETag'] = %("#{Digest::MD5.hexdigest(parts.join(""))}")
17:         [status, headers, parts]
18:       else
19:         [status, headers, body]
20:       end
21:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.