activeset 0.5.2 → 0.5.3

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: d7cdef49d5066bfce1716a02c22c6944be6e78b5
4
- data.tar.gz: 2e24745f57ba9312dce23a5d8d9ce3ad95f035fd
3
+ metadata.gz: 0342d1f291390f1b5e3e0654409d9071f381dc8f
4
+ data.tar.gz: 83c5079292686ff333a02c502b9018760067fb91
5
5
  SHA512:
6
- metadata.gz: afd9e636ca59c097baca307dd47e1bb25f8c18745a09f5665e5d118d2fca5e604f3a1bdafe73a997fea6d49941ae6bb6c556432c5289aa04cf0060de58955c05
7
- data.tar.gz: 40f35bb0ec2f2b83c1b7b1b511fd0641d4a45e962b4058b59565fc70bc2609eec616ab8aa9eb8425b78025eede79982472ba09580d38f9723e9366269c0d74cd
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
- self.class.new(filterer.process,
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
- self.class.new(sorter.process,
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
- self.class.new(paginater.process,
55
- instructions: @instructions.merge(paginate: instructions),
56
- total_count: @total_count)
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, pagesize)
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 pagesize
28
+ def page_size
29
29
  @instructions.get(:size) || 25
30
30
  end
31
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ActiveSet
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.3'
5
5
  end
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.2
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-24 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport