From e3b9a41d3b622c2ae7ade346ef4f1c4f0395559b Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Tue, 8 Jan 2013 20:35:57 -0800 Subject: [PATCH] Fix Middleman::Util.extract_response_text to follow the Rack spec (and thus work with rack 1.4.3) --- middleman-core/lib/middleman-core/util.rb | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/middleman-core/lib/middleman-core/util.rb b/middleman-core/lib/middleman-core/util.rb index 91a3b9f3..6702c73d 100644 --- a/middleman-core/lib/middleman-core/util.rb +++ b/middleman-core/lib/middleman-core/util.rb @@ -66,18 +66,12 @@ module Middleman # @param response The response from #call # @return [String] The whole response as a string. def self.extract_response_text(response) - case(response) - when String - response - when Array - response.join - when Rack::Response - response.body.join - when Rack::File - File.read(response.path) - else - response.to_s + # The rack spec states all response bodies must respond to each + result = '' + response.each do |part, s| + result << part end + result end # Takes a matcher, which can be a literal string