down 2.4.1 → 2.4.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: 5d380969c82066f3432f7d4cfa57f14f6e5beceb
4
- data.tar.gz: 81b21c1c687cc822c783672a59c2865bfec121a1
3
+ metadata.gz: 1b426820617504822aafdeca27a7fc75a9cc1ce4
4
+ data.tar.gz: 2d3a6d3ffd897d4f58f415906226532a928aeaea
5
5
  SHA512:
6
- metadata.gz: 0ac4b0b07f2b5c2cae6d23ac5cb03d11ebd4876d7b4cba042cdef5d74d74731ce41d47b83645c462c348a0e8b031f4e56b7ffba77198dc52ff65aaa258c0e816
7
- data.tar.gz: 1365d6e74dfc0679fa131b50418f92676144512d10a6552bfffdd5f3633e4a2ca08539c865ee3d55fe28870dc39005d960e33bd65affcaa378695726d445118f
6
+ metadata.gz: 373967a988ddd1a64bc2ca18cd73a6dfe393ba7c25a2fc831192535533d406ff4f77dc120c0b94a1a6b9b52c142b5452826b1948a91f1474b09a441457c8d2e2
7
+ data.tar.gz: cb187938e2fecc42af93032c8a5d14db44fe996b39c2e768b0c89c64e275e64b464cda3f228777d21f4b86f38fc2c2afdeacb15130783822f2e101171146f029
@@ -9,6 +9,8 @@ module Down
9
9
  @chunks = options.fetch(:chunks)
10
10
  @on_close = options.fetch(:on_close, ->{})
11
11
  @tempfile = Tempfile.new("down", binmode: true)
12
+
13
+ peek_chunk
12
14
  end
13
15
 
14
16
  def size
@@ -43,14 +45,16 @@ module Down
43
45
  def download_chunk
44
46
  chunk = @chunks.next
45
47
  write(chunk)
46
- begin
47
- @chunks.peek
48
- rescue StopIteration
49
- terminate_download
50
- end
48
+ peek_chunk
51
49
  chunk
52
50
  end
53
51
 
52
+ def peek_chunk
53
+ @chunks.peek
54
+ rescue StopIteration
55
+ terminate_download
56
+ end
57
+
54
58
  def enough_downloaded?(length)
55
59
  length && (@tempfile.pos + length <= @tempfile.size)
56
60
  end
@@ -1,3 +1,3 @@
1
1
  module Down
2
- VERSION = "2.4.1"
2
+ VERSION = "2.4.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: down
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-23 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake