rack-dev-mark 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df36ab5b5e659caeee87e9392be1626d6bc60834
4
- data.tar.gz: f152c7f27e311c166858de3403a0dd56e074910c
3
+ metadata.gz: fff2b9a8075587a3cd9e845a0c894cdb3ba57aca
4
+ data.tar.gz: 740888ac9204d53a0956cec0379c9c401f06b538
5
5
  SHA512:
6
- metadata.gz: 3287bb471bdf78d02ed55bb92a365f90042041a773db600ce2a429a656fb5e6a8bb462ca53a0a356a8976bb6009d40251537134c0ecf1751d8cc3e752ced7276
7
- data.tar.gz: 8618e72dfd9a95ed37ccae14038ab616e80673187c40cd8a6d24043492230163685638ee0e6844a22a6a417ba6503cedf868adb076a666a2425f67241ee4c431
6
+ metadata.gz: 975b82a47ccc2761bdb6015d8982a929db6cc8f299ac7d32bd5d0ba0e39ade48d848958622ede56463defffc347046137e2c7ed1284bd92fd45d2bae641651f3
7
+ data.tar.gz: 5987c26f01630eaf4dd057d415facb884887f1799d3d41d50bbcdcf1bc44957844b14ea0dea25f1cbba6ac0ea694123d7b029d5039cb0223417ef5c86bafe190
@@ -16,11 +16,17 @@ module Rack
16
16
  headers = HeaderHash.new(headers)
17
17
 
18
18
  if headers['Content-Type'].to_s =~ %r{^text/html;}i
19
- begin
20
- response = insert_dev_marks(response)
21
- rescue Rack::DevMark::Exception => e
22
- $stderr.write "Failed to insert dev marks: #{e.message}\n"
19
+ new_body = ''
20
+ response.each do |b|
21
+ begin
22
+ new_body << insert_dev_marks(b)
23
+ rescue Rack::DevMark::Exception => e
24
+ $stderr.write "Failed to insert dev marks: #{e.message}\n"
25
+ end
23
26
  end
27
+ response.close if response.respond_to?(:close)
28
+ headers['Content-Length'] &&= bytesize(new_body).to_s
29
+ response = [new_body]
24
30
  end
25
31
 
26
32
  [status, headers, response]
@@ -28,14 +34,10 @@ module Rack
28
34
 
29
35
  private
30
36
 
31
- def insert_dev_marks(response)
32
- body = ""
33
- response.each do |r|
34
- body.concat r.to_s
35
- end
37
+ def insert_dev_marks(body)
36
38
  body = @title.insert_into(body, Rack::DevMark.env, Rack::DevMark.revision)
37
39
  body = @theme.insert_into(body, Rack::DevMark.env, Rack::DevMark.revision)
38
- [body]
40
+ body
39
41
  end
40
42
  end
41
43
  end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module DevMark
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-dev-mark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daisuke Taniwaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-02 00:00:00.000000000 Z
11
+ date: 2014-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack