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 +4 -4
- data/lib/down/chunked_io.rb +9 -5
- data/lib/down/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b426820617504822aafdeca27a7fc75a9cc1ce4
|
4
|
+
data.tar.gz: 2d3a6d3ffd897d4f58f415906226532a928aeaea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 373967a988ddd1a64bc2ca18cd73a6dfe393ba7c25a2fc831192535533d406ff4f77dc120c0b94a1a6b9b52c142b5452826b1948a91f1474b09a441457c8d2e2
|
7
|
+
data.tar.gz: cb187938e2fecc42af93032c8a5d14db44fe996b39c2e768b0c89c64e275e64b464cda3f228777d21f4b86f38fc2c2afdeacb15130783822f2e101171146f029
|
data/lib/down/chunked_io.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/down/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2017-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|