query_string_interface 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,14 +52,22 @@ module QueryStringInterface
52
52
 
53
53
  def optimized_filter_parsers
54
54
  if or_filter_parser
55
- filter_parsers.inject([]) do |result, filter_parser|
56
- if filter_parser != or_filter_parser && or_filter_parser.include?(filter_parser)
57
- or_filter_parser.merge(filter_parser)
58
- else
59
- result << filter_parser
55
+ if or_filter_parser.value.is_a?(Array) && or_filter_parser.value.count == 1
56
+ or_inner_filters = or_filter_parser.value.first.with_indifferent_access.map do |raw_attribute, raw_value|
57
+ Filter.new(raw_attribute, raw_value, @attributes_to_replace, @raw_filters)
60
58
  end
59
+ filter_parsers.delete(or_filter_parser)
60
+ filter_parsers + or_inner_filters
61
+ else
62
+ filter_parsers.inject([]) do |result, filter_parser|
63
+ if filter_parser != or_filter_parser && or_filter_parser.include?(filter_parser)
64
+ or_filter_parser.merge(filter_parser)
65
+ else
66
+ result << filter_parser
67
+ end
61
68
 
62
- result
69
+ result
70
+ end
63
71
  end
64
72
  else
65
73
  filter_parsers
@@ -1,3 +1,3 @@
1
1
  module QueryStringInterface
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: query_string_interface
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.0
5
+ version: 0.4.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Vicente Mundim
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-07 00:00:00 Z
13
+ date: 2012-04-20 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -44,18 +44,18 @@ extensions: []
44
44
  extra_rdoc_files: []
45
45
 
46
46
  files:
47
- - lib/query_string_interface/filter.rb
48
- - lib/query_string_interface/filter_collection.rb
49
- - lib/query_string_interface/helpers.rb
47
+ - lib/query_string_interface.rb
50
48
  - lib/query_string_interface/parsers/array_parser.rb
51
- - lib/query_string_interface/parsers/boolean_and_nil_parser.rb
52
49
  - lib/query_string_interface/parsers/date_time_parser.rb
53
50
  - lib/query_string_interface/parsers/number_parser.rb
51
+ - lib/query_string_interface/parsers/boolean_and_nil_parser.rb
54
52
  - lib/query_string_interface/parsers/regex_parser.rb
53
+ - lib/query_string_interface/version.rb
54
+ - lib/query_string_interface/filter_collection.rb
55
+ - lib/query_string_interface/filter.rb
56
+ - lib/query_string_interface/helpers.rb
55
57
  - lib/query_string_interface/parsers.rb
56
58
  - lib/query_string_interface/sorting_filters.rb
57
- - lib/query_string_interface/version.rb
58
- - lib/query_string_interface.rb
59
59
  - MIT_LICENSE
60
60
  - README.md
61
61
  - Gemfile