mongoid_monkey 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f08602871ad1f23178fbcdb229ec18d40f385e70
4
- data.tar.gz: 65f0267dc96fdec8fb505754097e9fd0a447df63
3
+ metadata.gz: f0da38ef748517309df870fa4d43e8f76a874659
4
+ data.tar.gz: f7383666ee6df0a7ebaa5f508a069da887004f16
5
5
  SHA512:
6
- metadata.gz: 69ae75a8d969b6a215b65f51b1a42cc32712d3a80a86b605d1c1040190702240f78be792488774864e02c389814d4daf7f347e66cc10d9965c269d88820cd3ab
7
- data.tar.gz: 6999c691a45888d763881006dc1d2674521671fac1fee6fa0d95390f4bc7f5807f671a601b45e7033ecef1ac4aa3fdf5f05b45faa72e42dae68ee333c31be33e
6
+ metadata.gz: 4e742d660af83f2b147a6fd58776802d14689fc13a06446f0195d99a3c78218d246b212c06cbf64b351590deb88a864b0214f934ae83cc6edc8f9a9786352162
7
+ data.tar.gz: 8a24211a8bf84e5f218a4525914d22fdcc2411f548c80569f22168bcb611ec64aef49c7099ea8d1223ad7dd2630d04ade35347b89ee6badf1fb23493e2ef10fd
@@ -74,7 +74,7 @@ module Atomic
74
74
  if args.length == 1 && args.first.is_a?(Hash)
75
75
  query.update_all("$push" => collect_operations(args.first, true))
76
76
  else
77
- query.update_all("$push" => { database_field_name(args[0]) => { "$each" => args[1] } })
77
+ query.update_all("$push" => { database_field_name(args[0]) => { "$each" => Array.wrap(args[1]) } })
78
78
  end
79
79
  end
80
80
 
@@ -104,7 +104,7 @@ module Atomic
104
104
 
105
105
  def collect_operations(ops, use_each = false)
106
106
  ops.inject({}) do |operations, (field, value)|
107
- operations[database_field_name(field)] = use_each ? { '$each' => value.mongoize } : value.mongoize
107
+ operations[database_field_name(field)] = use_each ? { '$each' => Array.wrap(value.mongoize) } : value.mongoize
108
108
  operations
109
109
  end
110
110
  end
@@ -123,7 +123,7 @@ module Atomic
123
123
  end
124
124
 
125
125
  def operation(modifier)
126
- { modifier => { path => value.is_a?(Array) ? { "$each" => value } : value}}
126
+ { modifier => { path => { "$each" => Array.wrap(value) } } }
127
127
  end
128
128
  end
129
129
 
@@ -359,7 +359,7 @@ module Batchable
359
359
  inserts = pre_process_batch_insert(docs)
360
360
  if insertable?
361
361
  collection.find(selector).update(
362
- positionally(selector, operation => { path => use_each ? { '$each' => inserts } : inserts })
362
+ positionally(selector, operation => { path => use_each ? { '$each' => Array.wrap(inserts) } : inserts })
363
363
  )
364
364
  post_process_batch_insert(docs)
365
365
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module MongoidMonkey
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_monkey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - johnnyshields