eat 0.1.3 → 0.1.4

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/lib/eat.rb CHANGED
@@ -47,15 +47,16 @@ module Eat
47
47
  end
48
48
  http = ::HTTPClient.new
49
49
  http.redirect_uri_callback = ::Proc.new { |uri, res| ::URI.parse(res.header['location'][0]) }
50
+ http.transparent_gzip_decompression = true
50
51
  http.receive_timeout = timeout
51
52
  if uri.scheme == 'https'
52
53
  http.ssl_config.verify_mode = openssl_verify_mode
53
54
  end
54
55
  catch :stop do
55
56
  http.get_content(uri.to_s) do |chunk|
56
- throw :stop if read_so_far > limit
57
- read_so_far += chunk.length
58
57
  body << chunk
58
+ read_so_far += chunk.length
59
+ throw :stop if read_so_far > limit
59
60
  end
60
61
  end
61
62
  end
@@ -1,3 +1,3 @@
1
1
  module Eat
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -74,4 +74,8 @@ class TestEat < Test::Unit::TestCase
74
74
  def test_reads_compressed
75
75
  assert eat('http://www.sears.com/shc/s/p_10153_12605_07692286000P?prdNo=8&blockNo=8&blockType=G8').include?('New Balance')
76
76
  end
77
+
78
+ def test_chunks_work_out
79
+ assert eat('http://www.thinkgeek.com/interests/giftsforhim/60b6/').include?('DOCTYPE HTML PUBLIC')
80
+ end
77
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-05 00:00:00.000000000Z
12
+ date: 2011-12-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient
16
- requirement: &2172837000 !ruby/object:Gem::Requirement
16
+ requirement: &2161894800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2172837000
24
+ version_requirements: *2161894800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: test-unit
27
- requirement: &2172836540 !ruby/object:Gem::Requirement
27
+ requirement: &2161880220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2172836540
35
+ version_requirements: *2161880220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &2172836120 !ruby/object:Gem::Requirement
38
+ requirement: &2161879100 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2172836120
46
+ version_requirements: *2161879100
47
47
  description: A (better?) replacement for open-uri. Gets the contents of local and
48
48
  remote files as a String, no questions asked.
49
49
  email: