actionset 0.3.4 → 0.3.5

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: 94c2718c8e23f7c7366d789850324fe3980bd686
4
- data.tar.gz: a416c81e64c3f35fe254f0b4fa294eb8fa97bedf
3
+ metadata.gz: bcf22ea0b6bf2bc8736afb56c36e8223d1aa70df
4
+ data.tar.gz: 56fec8d7cc74be2aaa9a5b54504b16fadb78a154
5
5
  SHA512:
6
- metadata.gz: 8336b7f82a1b640ae3ac99aba35c85c9067fb331329f96d0e84b49e98fa0ad9dd92c81c34d6420d77114096c82ae49699ed4d8f66bffd2750ee99718f9117fbb
7
- data.tar.gz: 16933793296c6a5015b1dc2e48386cd3e2294bc9738d3c2674b606fbec62af476ba72e7c7417c893e5e6cec39fed41db53c8a513c8116cb60ddfe2cf001e87ae
6
+ metadata.gz: fe390e2de9dcaec0cc4f0d9b293acc70cb6019c56362a14ba1062947ed04fa32562e9adaa3eff6e2f7a670ce7086b7c411214e9cb388f8527365eba726e25791
7
+ data.tar.gz: e81f275a7a8f82efad37b7c9ac741523f8fca6e0d8b8f8ab5b0b63e7d4a171d0f24332ea169386658e18bce83e360d1ba5e7101b1e03a40516c167dce4c784a2
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v 0.3.5
2
+ - Don't rely on an instance variable for the `filter_structure`
3
+ - Use the `ensure_active_set` method inside of `process_set`
1
4
  v 0.3.4
2
5
  - Ensure that the sort_link_for helper method make the title param optional
3
6
  - Ensure that the view helpers are properly included into the ActionView context
data/lib/action_set.rb CHANGED
@@ -27,14 +27,13 @@ module ActionSet
27
27
 
28
28
  module InstanceMethods
29
29
  def process_set(set)
30
- @set = set
31
- paginate_set(sort_set(filter_set(ActiveSet.new(set))))
30
+ paginate_set(sort_set(filter_set(ensure_active_set(set))))
32
31
  end
33
32
 
34
33
  def filter_set(set)
35
34
  set_filters_ivar
36
35
  active_set = ensure_active_set(set)
37
- active_set = active_set.filter(filter_structure) if filter_params.any?
36
+ active_set = active_set.filter(filter_structure(set)) if filter_params.any?
38
37
  active_set
39
38
  end
40
39
 
@@ -64,10 +63,10 @@ module ActionSet
64
63
 
65
64
  private
66
65
 
67
- def filter_structure
66
+ def filter_structure(set)
68
67
  filter_params.flatten_keys.reject { |_, v| v.blank? }.each_with_object({}) do |(keypath, value), memo|
69
68
  instruction = ActiveSet::Instructions::Entry.new(keypath, value)
70
- item_with_value = @set.find { |i| !instruction.value_for(item: i).nil? }
69
+ item_with_value = set.find { |i| !instruction.value_for(item: i).nil? }
71
70
  item_value = instruction.value_for(item: item_with_value)
72
71
  typecast_value = ActionSet::Instructions::EntryValue.new(value)
73
72
  .cast(to: item_value.class)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionSet
4
- VERSION = '0.3.4'
4
+ VERSION = '0.3.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionset
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
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-11-01 00:00:00.000000000 Z
11
+ date: 2018-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeset