glebtv-mongoid_nested_set 0.4.0 → 0.4.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: a07ed6d681a31e48faa1d490812bf2d556505368
4
- data.tar.gz: 5cea8896930423eb28967620a12d1e21c4892553
3
+ metadata.gz: 06f74b01b36e9f6e96dbc59aacdc68b68069182d
4
+ data.tar.gz: 7acff99227594a6601f8141a99bf60408987d16d
5
5
  SHA512:
6
- metadata.gz: 85bac01380f2f967f260ae41bc349cbbe2a97c1efdc5a7f0dbeb503036b339a73377c31c2023aa5ec6d13b0085b6260062367933253db0e9881a16f597a43bf8
7
- data.tar.gz: 25f4ad3e4fd16afbcd5a849b86af10a7e105966ccabfac5ff1d2c00c25992ee5dc64d9b33010e693468d424789356d20cfb9c1361b7b056dd82d60ab11a20213
6
+ metadata.gz: 0cb2a314591b0f6b80c1c6caa626c6b249980c2a6c91a8fef10921abc930f91d8370aa54494ac7b1f4f7b18d686ee5a963f934f8ac8a2747ca8d988c3cf59a9d
7
+ data.tar.gz: 36eca30d0546e7f262cc103731500a528c341ff2e5a9ae00ddd86f3880dde97e6886155295b8c16d429c0e8f64ff6045ae86b78ac8173c58c8a909016670f07e
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0-p195
1
+ 2.0.0-p247
@@ -214,13 +214,15 @@ module Mongoid::Acts::NestedSet
214
214
  # update lefts and rights for remaining nodes
215
215
  diff = right - left + 1
216
216
 
217
- scope_class.with(:safe => true).where(
217
+ c = scope_class.with(:safe => true).where(
218
218
  nested_set_scope.where(left_field_name.to_sym.gt => right).selector
219
- ).inc(left_field_name, -diff)
219
+ )
220
+ mongoid_inc(c, left_field_name, -diff)
220
221
 
221
- scope_class.with(:safe => true).where(
222
+ c = scope_class.with(:safe => true).where(
222
223
  nested_set_scope.where(right_field_name.to_sym.gt => right).selector
223
- ).inc(right_field_name, -diff)
224
+ )
225
+ mongoid_inc(c, right_field_name, -diff)
224
226
 
225
227
  # Don't allow multiple calls to destroy to corrupt the set
226
228
  self.skip_before_destroy = true
@@ -236,5 +238,13 @@ module Mongoid::Acts::NestedSet
236
238
  end
237
239
  end
238
240
 
241
+ def mongoid_inc(criteria, field, value)
242
+ if Mongoid::VERSION.to_i < 4
243
+ criteria.inc(field, value)
244
+ else
245
+ criteria.inc({field => value})
246
+ end
247
+ end
248
+
239
249
  end
240
250
  end
@@ -1,3 +1,3 @@
1
1
  module MongoidNestedSet
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glebtv-mongoid_nested_set
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GlebTV
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-22 00:00:00.000000000 Z
12
+ date: 2013-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  requirements: []
144
144
  rubyforge_project: mongoid_nested_set
145
- rubygems_version: 2.0.3
145
+ rubygems_version: 2.0.6
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Nested set based tree implementation for Mongoid