hoptoad_notifier 2.4.5 → 2.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ Version 2.4.6 - Tue Feb 15 15:51:17 -0500 2011
2
+ ===============================================================================
3
+
4
+ Jonathan Yurek(1):
5
+ Modify the error page's body in-place.
6
+
1
7
  Version 2.4.5 - Wed Feb 02 13:24:29 -0500 2011
2
8
  ===============================================================================
3
9
 
@@ -402,5 +408,6 @@ Nick Quaranto (3):
402
408
 
403
409
 
404
410
 
411
+
405
412
 
406
413
 
@@ -9,20 +9,14 @@ module HoptoadNotifier
9
9
  end
10
10
 
11
11
  def call(env)
12
- response = @app.call(env)
12
+ status, headers, body = @app.call(env)
13
13
  if env['hoptoad.error_id']
14
- new_response = []
15
- original_content_length = 0
16
- modified_content_length = 0
17
- response[2].each do |chunk|
18
- original_content_length += chunk.length
19
- new_response << chunk.to_s.gsub("<!-- HOPTOAD ERROR -->", replacement(env['hoptoad.error_id']))
20
- modified_content_length += new_response.last.length
14
+ body.each_with_index do |chunk, i|
15
+ body[i] = chunk.to_s.gsub("<!-- HOPTOAD ERROR -->", replacement(env['hoptoad.error_id']))
21
16
  end
22
- response[1]['Content-Length'] = modified_content_length.to_s
23
- response[2] = new_response
17
+ headers['Content-Length'] = body.sum(&:length).to_s
24
18
  end
25
- response
19
+ [status, headers, body]
26
20
  end
27
21
  end
28
22
  end
@@ -1,3 +1,3 @@
1
1
  module HoptoadNotifier
2
- VERSION = "2.4.5".freeze
2
+ VERSION = "2.4.6".freeze
3
3
  end
@@ -4,7 +4,7 @@ class UserInformerTest < Test::Unit::TestCase
4
4
  should "modify output if there is a hoptoad id" do
5
5
  main_app = lambda do |env|
6
6
  env['hoptoad.error_id'] = 1
7
- [200, {}, "<!-- HOPTOAD ERROR -->"]
7
+ [200, {}, ["<!-- HOPTOAD ERROR -->"]]
8
8
  end
9
9
  informer_app = HoptoadNotifier::UserInformer.new(main_app)
10
10
 
@@ -17,7 +17,7 @@ class UserInformerTest < Test::Unit::TestCase
17
17
 
18
18
  should "not modify output if there is no hoptoad id" do
19
19
  main_app = lambda do |env|
20
- [200, {}, "<!-- HOPTOAD ERROR -->"]
20
+ [200, {}, ["<!-- HOPTOAD ERROR -->"]]
21
21
  end
22
22
  informer_app = HoptoadNotifier::UserInformer.new(main_app)
23
23
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoptoad_notifier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 4
9
- - 5
10
- version: 2.4.5
9
+ - 6
10
+ version: 2.4.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - thoughtbot, inc
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-02 00:00:00 -05:00
18
+ date: 2011-02-15 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency