query_string_interface 0.6.2 → 0.6.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 495587c8e1031bc3d990a6805a15ae017557cebe
|
4
|
+
data.tar.gz: 527a145f1ef759b3cd749db88def744ed4a258b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fe4d51f6ac48b8b5a55b2bdc2d6dade987cb9e9d48e385c0871ec4be181463e834a42b4f47ce65ef95c2c99a64dd464748d94e8d1173c28ea576e9e938b2c33
|
7
|
+
data.tar.gz: 6624b1761fd0e101440c49c7477bc51a0c0c2deecc6680a81037f69ecd8b40e602684ff1dc8183ebbc899d804c5049adda524f9600406dc79cae3719aca68b98
|
data/Gemfile.lock
CHANGED
@@ -38,6 +38,10 @@ module QueryStringInterface
|
|
38
38
|
raw_attribute == 'or'
|
39
39
|
end
|
40
40
|
|
41
|
+
def or_value
|
42
|
+
@or_value ||= JSON.parse(raw_value) if or_attribute?
|
43
|
+
end
|
44
|
+
|
41
45
|
def include?(other_filter)
|
42
46
|
if or_attribute?
|
43
47
|
json_value.any? do |filters|
|
@@ -63,8 +67,10 @@ module QueryStringInterface
|
|
63
67
|
result[filter_operation] = filter_value
|
64
68
|
result
|
65
69
|
end
|
66
|
-
|
70
|
+
elsif !operator.nil? && !other_filter.operator.nil?
|
67
71
|
@value = value.merge(other_filter.value)
|
72
|
+
else
|
73
|
+
raise MixedArgumentError, "arguments `#{raw_attribute}` and `#{other_filter.raw_attribute}` could not be mixed"
|
68
74
|
end
|
69
75
|
end
|
70
76
|
|
@@ -53,7 +53,7 @@ module QueryStringInterface
|
|
53
53
|
def optimized_filter_parsers
|
54
54
|
if or_filter_parser
|
55
55
|
if or_filter_parser.value.is_a?(Array) && or_filter_parser.value.count == 1
|
56
|
-
or_inner_filters = or_filter_parser.
|
56
|
+
or_inner_filters = or_filter_parser.or_value.first.with_indifferent_access.map do |raw_attribute, raw_value|
|
57
57
|
Filter.new(raw_attribute, raw_value, @attributes_to_replace, @raw_filters)
|
58
58
|
end
|
59
59
|
filter_parsers.delete(or_filter_parser)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: query_string_interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vicente Mundim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|