mongoid_query_string_interface 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid_query_string_interface (0.5.0)
4
+ mongoid_query_string_interface (0.5.1)
5
5
  json (>= 1.4.6)
6
6
  mongoid (~> 2.0.2)
7
7
  will_paginate (~> 3.0.pre2)
@@ -10,13 +10,21 @@ module Mongoid
10
10
 
11
11
  def parse(value)
12
12
  value.split(ARRAY_SEPARATOR).map(&:strip).map do |item|
13
- regex_parser.parse(item) or item
13
+ parse_item(item)
14
14
  end
15
15
  end
16
16
 
17
17
  private
18
- def regex_parser
19
- @regex_parser ||= RegexParser.new
18
+ def parse_item(item)
19
+ other_parsers.each do |parser|
20
+ return parser.parse(item) if parser.parseable?(item, '')
21
+ end
22
+ end
23
+
24
+ def other_parsers
25
+ @other_parsers ||= Mongoid::QueryStringInterface::Parsers::FilterParser::PARSERS.reject do |parser|
26
+ parser.is_a?(ArrayParser)
27
+ end
20
28
  end
21
29
 
22
30
  def conditional_operators
@@ -15,9 +15,9 @@ module Mongoid
15
15
  attr_reader :raw_attribute, :raw_value
16
16
 
17
17
  PARSERS = [
18
+ Mongoid::QueryStringInterface::Parsers::ArrayParser.new,
18
19
  Mongoid::QueryStringInterface::Parsers::DateTimeParser.new,
19
20
  Mongoid::QueryStringInterface::Parsers::NumberParser.new,
20
- Mongoid::QueryStringInterface::Parsers::ArrayParser.new,
21
21
  Mongoid::QueryStringInterface::Parsers::RegexParser.new,
22
22
  Mongoid::QueryStringInterface::Parsers::BooleanAndNilParser.new
23
23
  ]
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid #:nodoc
3
3
  module QueryStringInterface #:nodoc
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.1"
5
5
  end
6
6
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mongoid_query_string_interface
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.0
5
+ version: 0.5.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Vicente Mundim