Permalink
Browse files

deflater.rb - Removed unnecessary require "time" and whitespace

  • Loading branch information...
1 parent d2d51ff commit a2157d005827de41aa67ec046c618feaf69196ee @qerub qerub committed with Jul 4, 2008
Showing with 4 additions and 5 deletions.
  1. +2 −3 lib/rack/deflater.rb
  2. +2 −2 test/spec_rack_deflater.rb
@@ -1,6 +1,5 @@
require "zlib"
require "stringio"
-require "time"
module Rack
@@ -12,7 +11,7 @@ def initialize(app)
def call(env)
status, headers, body = @app.call(env)
- request = Request.new(env)
+ request = Request.new(env)
encoding = Utils.select_best_encoding(%w(gzip deflate identity), request.accept_encoding)
@@ -30,7 +29,7 @@ def call(env)
end
end
- def self.gzip(body, mtime=Time.now)
+ def self.gzip(body, mtime = Time.now)
io = StringIO.new
gzip = Zlib::GzipWriter.new(io)
gzip.mtime = mtime
@@ -12,7 +12,7 @@ def build_response(body, accept_encoding, headers = {})
return response
end
-
+
specify "should be able to deflate bodies that respond to each" do
body = Object.new
class << body; def each; yield("foo"); yield("bar"); end; end
@@ -32,7 +32,7 @@ class << body; def each; yield("foo"); yield("bar"); end; end
response[1].should.equal({ "Content-Encoding" => "deflate" })
response[2].to_s.should.equal("\363H\315\311\311W(\317/\312IQ\004\000")
end
-
+
specify "should be able to gzip bodies that respond to each" do
body = Object.new
class << body; def each; yield("foo"); yield("bar"); end; end

0 comments on commit a2157d0

Please sign in to comment.