mongoid_query_string_interface 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -149,7 +149,19 @@ module Mongoid
149
149
  end
150
150
 
151
151
  def sorting_parameter?(key, value)
152
- key.to_s == 'order_by' or key.match(/(.*)\.(#{SORTING_OPERATORS.join('|')})/) or SORTING_OPERATORS.include?(value.to_sym)
152
+ order_by_parameter?(key) or sorting_key_parameter?(key) or sorting_value_parameter?(value)
153
+ end
154
+
155
+ def order_by_parameter?(key)
156
+ key.to_s == 'order_by'
157
+ end
158
+
159
+ def sorting_key_parameter?(key)
160
+ key.match(/(.*)\.(#{SORTING_OPERATORS.join('|')})/)
161
+ end
162
+
163
+ def sorting_value_parameter?(value)
164
+ value.present? && SORTING_OPERATORS.include?(value.to_sym)
153
165
  end
154
166
 
155
167
  def parse_order_by(options)
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.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_query_string_interface
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vicente Mundim
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-17 00:00:00 -03:00
18
+ date: 2010-08-18 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency