community_theatre 0.1.0 → 0.2.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 942c3432aa71b70d6195193ac48d43e69bbd3bb965d50313f392c0cda457922e
|
4
|
+
data.tar.gz: 2ce57da5dedc494916e607c13011c404cc51c5f0b442300aa76e5f4ef6f5ea8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 844a6bc670e193cfbf373c9ab317f071bb76c080223daeb7ac3e0cc3cfbb438410ad7d40dea5c3a4e3a40bfed3ba1508f6f0507891bf906bea9e0ac2f9a027cb
|
7
|
+
data.tar.gz: 22f75fa53e89bff511d70773bce51b689158f98026b2bf73a6e78ab9f95233816f25af84457a07ccfd882dae4cf5e2bec5203ba2e39a4ba9b9b7e789c77a3b1a
|
@@ -15,19 +15,21 @@ module CommunityTheatre
|
|
15
15
|
packer = MessagePack::Packer.new(file)
|
16
16
|
packer.write_array_header(page.size)
|
17
17
|
|
18
|
-
page.each {|item| packer.write(item)}
|
18
|
+
page.each { |item| packer.write(item) }
|
19
19
|
|
20
20
|
packer.flush
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
# implementation of "starting_at" is only to the page level
|
26
|
+
# (see #pages)
|
27
|
+
def unspool(starting_at = 0)
|
26
28
|
Enumerator.new do |yielder|
|
27
|
-
|
29
|
+
pages(starting_at).each do |page_no|
|
28
30
|
file_for_page(page_no, 'r') do |file|
|
29
31
|
page = MessagePack::Unpacker.new(file).unpack
|
30
|
-
page.each {|item| yielder << item}
|
32
|
+
page.each { |item| yielder << item }
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
@@ -35,13 +37,21 @@ module CommunityTheatre
|
|
35
37
|
|
36
38
|
private
|
37
39
|
|
40
|
+
# implementation of "skip_items" is only to the page level
|
41
|
+
def pages(skip_items = nil)
|
42
|
+
skip_items ||= 0
|
43
|
+
skip_pages = (skip_items / @page_size).floor
|
44
|
+
|
45
|
+
existing_pages.drop(skip_pages)
|
46
|
+
end
|
47
|
+
|
38
48
|
def existing_pages
|
39
49
|
Dir.entries(@destination)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
50
|
+
.map{ |n| File.join(@destination, n) }
|
51
|
+
.filter { |n| File.file?(n) }
|
52
|
+
.filter { |n| n =~ /\/\d+$/ }
|
53
|
+
.map { |n| /\/(\d+)$/.match(n)[1].to_i }
|
54
|
+
.sort
|
45
55
|
end
|
46
56
|
|
47
57
|
def path_for_page(n)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: community_theatre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liam Dawson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|