origin 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/lib/origin/extensions/string.rb +1 -1
- data/lib/origin/extensions/symbol.rb +1 -1
- data/lib/origin/key.rb +1 -1
- data/lib/origin/selectable.rb +11 -2
- data/lib/origin/version.rb +1 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/lib/origin/key.rb
CHANGED
@@ -57,7 +57,7 @@ module Origin
|
|
57
57
|
def specify(object, negating = false)
|
58
58
|
value = block ? block[object] : object
|
59
59
|
expression = { operator => expanded ? { expanded => value } : value }
|
60
|
-
{ name.to_s => negating ? { "$not" => expression } : expression }
|
60
|
+
{ name.to_s => (negating && operator != "$not") ? { "$not" => expression } : expression }
|
61
61
|
end
|
62
62
|
|
63
63
|
# Get the key as raw Mongo sorting options.
|
data/lib/origin/selectable.rb
CHANGED
@@ -352,12 +352,21 @@ module Origin
|
|
352
352
|
# @example Negate the selection.
|
353
353
|
# selectable.not.in(field: [ 1, 2 ])
|
354
354
|
#
|
355
|
+
# @example Add the $not criterion.
|
356
|
+
# selectable.not(name: /Bob/)
|
357
|
+
#
|
358
|
+
# @example Execute a $not in a where query.
|
359
|
+
# selectable.where(:field.not => /Bob/)
|
360
|
+
#
|
361
|
+
# @param [ Hash ] criterion The field/value pairs to negate.
|
362
|
+
#
|
355
363
|
# @return [ Selectable ] The negated selectable.
|
356
364
|
#
|
357
365
|
# @since 1.0.0
|
358
|
-
def not
|
359
|
-
tap { |query| query.negating = true }
|
366
|
+
def not(*criterion)
|
367
|
+
(criterion.size == 0) ? tap { |query| query.negating = true } : __override__(criterion.first, "$not")
|
360
368
|
end
|
369
|
+
key :not, :override, "$not"
|
361
370
|
|
362
371
|
# Adds $or selection to the selectable.
|
363
372
|
#
|
data/lib/origin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: origin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -145,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
segments:
|
147
147
|
- 0
|
148
|
-
hash:
|
148
|
+
hash: 1767126872631308027
|
149
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
150
|
none: false
|
151
151
|
requirements:
|