From a2157d005827de41aa67ec046c618feaf69196ee Mon Sep 17 00:00:00 2001 From: Christoffer Sawicki Date: Fri, 4 Jul 2008 23:57:05 +0200 Subject: [PATCH] deflater.rb - Removed unnecessary require "time" and whitespace --- lib/rack/deflater.rb | 5 ++--- test/spec_rack_deflater.rb | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/rack/deflater.rb b/lib/rack/deflater.rb index 20401a455..d4f4e1375 100644 --- a/lib/rack/deflater.rb +++ b/lib/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 diff --git a/test/spec_rack_deflater.rb b/test/spec_rack_deflater.rb index 33d984aec..db75d3921 100644 --- a/test/spec_rack_deflater.rb +++ b/test/spec_rack_deflater.rb @@ -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