refiner 1.0.0 → 1.0.2

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: 57007e32a2ef5b67cdd1dc49c8debc02fe5a4c70
4
- data.tar.gz: f21dc050c82de397639aca188f6036a1650b8377
3
+ metadata.gz: 8f496805ed02d5b66672b287208020df4e1a2999
4
+ data.tar.gz: 4e5fceaccac55662bb661604ad4f5a16f897b3c8
5
5
  SHA512:
6
- metadata.gz: 186849728e79f2b6b460aeeb64480973ab2e6befc7e4f16b77b451520c41f2270dbeeb0ade1cfe862a56f54b1da24d8cf0169c9c7e49f9853653e63ccb3e722b
7
- data.tar.gz: ddffd09e781b0b89e27c21d0a93c1cd2e8c93ddd3ab97326d5b3a996a5a609b8adfd3404071e678e976607d8d35a946a68f41c2a83cdfe7d8050c5eb8efe7606
6
+ metadata.gz: ab2b31ca35cade30df4efc425f5a4a41aeb1a4e149bc1e9c2cdc2f57cb13d955e0ca87b5dcf756a383dc0cb1ec584adda28b9cec8a1a79d5d9580888493f152c
7
+ data.tar.gz: f873858a0365acb9c2f64c7ce7eabe565c07beae3098b18671b9fb6589c184a0a326068a59179ce9f8981ec5d141ed873600e9911db04d1ee407d60a3250dbd6
@@ -1,4 +1,5 @@
1
1
  require "rails"
2
+ require "refiner/query"
2
3
  require "refiner/version"
3
4
 
4
5
  module Refiner
@@ -16,11 +17,11 @@ module Refiner
16
17
  end
17
18
 
18
19
  def refiner_active? scope, slug
19
- (query[scope.to_s] || "").split(/,/).include?(slug.to_s) ? 'active' : nil
20
+ (refiner_query[scope.to_s] || "").split(/,/).include?(slug.to_s) ? 'active' : nil
20
21
  end
21
22
 
22
23
  def refiner_value action, scope, slug
23
- REFINER_VALUE[refiner_value_selector(action, scope, slug)].call(query, scope, slug)
24
+ REFINER_VALUE[refiner_value_selector(action, scope, slug)].call(refiner_query, scope, slug)
24
25
  end
25
26
 
26
27
  def refiner_value_selector action, scope, slug
@@ -30,9 +31,9 @@ module Refiner
30
31
  def refiners action, scope, slug
31
32
  merge_values = refiner_value action, scope, slug
32
33
  if merge_values.present?
33
- query.merge({ scope => merge_values })
34
+ refiner_query.merge({ scope => merge_values })
34
35
  else
35
- query.delete_if { |k, v| k == scope }
36
+ refiner_query.delete_if { |k, v| k == scope }
36
37
  end
37
38
  end
38
39
  end
@@ -0,0 +1,18 @@
1
+ module Refiner
2
+ module Query
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ helper_method :refiner_query
7
+ helper_method :segment_refiner_query_by
8
+ end
9
+
10
+ def segment_refiner_query_by(*detectors)
11
+ refiner_query.slice(*detectors) rescue {}
12
+ end
13
+
14
+ def refiner_query
15
+ Hash[*params[:query].split(/\//)] rescue {}
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Refiner
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refiner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zack Siri
@@ -54,6 +54,7 @@ files:
54
54
  - bin/console
55
55
  - bin/setup
56
56
  - lib/refiner.rb
57
+ - lib/refiner/query.rb
57
58
  - lib/refiner/version.rb
58
59
  - refiner.gemspec
59
60
  homepage: http://github.com/zacksiri/refiner