mongomatic 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongomatic.rb +1 -0
- data/lib/mongomatic/base.rb +1 -0
- data/lib/mongomatic/modifiers.rb +4 -4
- data/lib/mongomatic/util.rb +7 -0
- metadata +3 -2
data/lib/mongomatic.rb
CHANGED
@@ -29,6 +29,7 @@ module Mongomatic
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
require "#{File.dirname(__FILE__)}/mongomatic/util"
|
32
33
|
require "#{File.dirname(__FILE__)}/mongomatic/m_hash"
|
33
34
|
require "#{File.dirname(__FILE__)}/mongomatic/cursor"
|
34
35
|
require "#{File.dirname(__FILE__)}/mongomatic/modifiers"
|
data/lib/mongomatic/base.rb
CHANGED
data/lib/mongomatic/modifiers.rb
CHANGED
@@ -44,7 +44,7 @@ module Mongomatic
|
|
44
44
|
raise(UnexpectedFieldType)
|
45
45
|
end
|
46
46
|
|
47
|
-
val =
|
47
|
+
val = create_array(val)
|
48
48
|
op = { "$pushAll" => { mongo_field => val } }
|
49
49
|
res = true
|
50
50
|
|
@@ -101,14 +101,14 @@ module Mongomatic
|
|
101
101
|
raise(UnexpectedFieldType)
|
102
102
|
end
|
103
103
|
|
104
|
-
op = { "$pullAll" => { mongo_field =>
|
104
|
+
op = { "$pullAll" => { mongo_field => create_array(val) } }
|
105
105
|
res = true
|
106
106
|
|
107
107
|
safe == true ? res = update!({}, op) : update({}, op)
|
108
108
|
|
109
109
|
if res
|
110
110
|
hash[field] ||= []
|
111
|
-
|
111
|
+
create_array(val).each do |v|
|
112
112
|
hash[field].delete(v)
|
113
113
|
end; true
|
114
114
|
end
|
@@ -215,7 +215,7 @@ module Mongomatic
|
|
215
215
|
|
216
216
|
if res
|
217
217
|
hash[field] ||= []
|
218
|
-
|
218
|
+
create_array(val).each do |v|
|
219
219
|
hash[field] << v unless hash[field].include?(v)
|
220
220
|
end
|
221
221
|
true
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 5
|
9
|
+
version: 0.5.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ben Myles
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/mongomatic/expectations/present.rb
|
100
100
|
- lib/mongomatic/m_hash.rb
|
101
101
|
- lib/mongomatic/modifiers.rb
|
102
|
+
- lib/mongomatic/util.rb
|
102
103
|
- LICENSE
|
103
104
|
- README.rdoc
|
104
105
|
- test/helper.rb
|