activeset 0.5.2 → 0.5.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/lib/active_set.rb +13 -9
- data/lib/active_set/processors/paginate_processor.rb +2 -2
- data/lib/active_set/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: 0342d1f291390f1b5e3e0654409d9071f381dc8f
|
4
|
+
data.tar.gz: 83c5079292686ff333a02c502b9018760067fb91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb3429bee37af5438798de2c18f7aef16bca7508918054bb6afea0bddfb0641bf945477863f892ce9e4d3c9a6d26ac09d8d7a985d9c69e1115650e2231a243f2
|
7
|
+
data.tar.gz: 39bbf742bc1420ddf751a14bf8ea66b42115b799d5682b60c5d7126c77c44eef70f92f144e8b690d26afc288189ce4883a93b09bc78d7bc6a5be522d422538fd
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
v 0.5.3
|
2
|
+
- Extract logic for creating new ActiveSet instance after an operation into separate method
|
3
|
+
- Ensure that the instructions logged for the paginate operation handle defaults
|
1
4
|
v 0.5.2
|
2
5
|
- Add an ActiveRecord adapter for the PaginateProcessor
|
3
6
|
- Update the EnumerableAdapter for the PaginateProcessor to more consistently handle edgecases
|
data/lib/active_set.rb
CHANGED
@@ -37,27 +37,31 @@ class ActiveSet
|
|
37
37
|
|
38
38
|
def filter(instructions)
|
39
39
|
filterer = FilterProcessor.new(@set, instructions)
|
40
|
-
|
41
|
-
instructions: @instructions.merge(filter: instructions),
|
42
|
-
total_count: @total_count)
|
40
|
+
new_active_set(filterer.process, :filter, instructions)
|
43
41
|
end
|
44
42
|
|
45
43
|
def sort(instructions)
|
46
44
|
sorter = SortProcessor.new(@set, instructions)
|
47
|
-
|
48
|
-
instructions: @instructions.merge(sort: instructions),
|
49
|
-
total_count: @total_count)
|
45
|
+
new_active_set(sorter.process, :sort, instructions)
|
50
46
|
end
|
51
47
|
|
52
48
|
def paginate(instructions)
|
53
49
|
paginater = PaginateProcessor.new(@set, instructions)
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
full_instructions = instructions.reverse_merge(page: paginater.send(:page_number),
|
51
|
+
size: paginater.send(:page_size))
|
52
|
+
new_active_set(paginater.process, :paginate, full_instructions)
|
57
53
|
end
|
58
54
|
|
59
55
|
def transform(instructions)
|
60
56
|
transformer = TransformProcessor.new(@set, instructions)
|
61
57
|
transformer.process
|
62
58
|
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def new_active_set(set, method, instructions)
|
63
|
+
self.class.new(set,
|
64
|
+
instructions: @instructions.merge(method => instructions),
|
65
|
+
total_count: @total_count)
|
66
|
+
end
|
63
67
|
end
|
@@ -18,14 +18,14 @@ class ActiveSet
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def instruction
|
21
|
-
Instructions::Entry.new(page_number,
|
21
|
+
Instructions::Entry.new(page_number, page_size)
|
22
22
|
end
|
23
23
|
|
24
24
|
def page_number
|
25
25
|
@instructions.get(:page) || 1
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def page_size
|
29
29
|
@instructions.get(:size) || 25
|
30
30
|
end
|
31
31
|
end
|
data/lib/active_set/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Margheim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|