mongoid 7.5.0 → 7.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/mongoid/equality.rb +4 -4
- data/lib/mongoid/scopable.rb +11 -9
- data/lib/mongoid/version.rb +1 -1
- data/spec/mongoid/equality_spec.rb +12 -12
- data/spec/mongoid/scopable_spec.rb +33 -15
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35ea6871ead43684bcaba29452a4d21a63d40a2703e5a954c60318bc4242759f
|
4
|
+
data.tar.gz: bb819713b38b1639d9e0ccc4ac95bd171a054fc1025b330cbac492f980d93015
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80981e2b9473bac38edf29ee73aa49f4f5932b577ee8095e1af9407f113e9a156f5860049300c8b486ec66ff267ec8fd9b91007697d3d6e953cc65580e29e4b9
|
7
|
+
data.tar.gz: 45077ad45b7d833dddaee515736c3faf54b5472e684a1e0e4220c1bff1b6ba6b9284bea082b235eb7371540af95481e728ad09c082ae40f5cf3d6d77f45e2f11
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/mongoid/equality.rb
CHANGED
@@ -44,9 +44,9 @@ module Mongoid
|
|
44
44
|
# @return [ true, false ] True if the classes are equal, false if not.
|
45
45
|
def ===(other)
|
46
46
|
if Mongoid.legacy_triple_equals
|
47
|
-
super
|
48
|
-
else
|
49
47
|
other.class == Class ? self.class === other : self == other
|
48
|
+
else
|
49
|
+
super
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -73,9 +73,9 @@ module Mongoid
|
|
73
73
|
# @return [ true, false ] True if the classes are equal, false if not.
|
74
74
|
def ===(other)
|
75
75
|
if Mongoid.legacy_triple_equals
|
76
|
-
other.is_a?(self)
|
77
|
-
else
|
78
76
|
other.class == Class ? self <= other : other.is_a?(self)
|
77
|
+
else
|
78
|
+
other.is_a?(self)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
data/lib/mongoid/scopable.rb
CHANGED
@@ -289,15 +289,17 @@ module Mongoid
|
|
289
289
|
# @return [ Method ] The defined method.
|
290
290
|
def define_scope_method(name)
|
291
291
|
singleton_class.class_eval do
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
292
|
+
ruby2_keywords(
|
293
|
+
define_method(name) do |*args|
|
294
|
+
scoping = _declared_scopes[name]
|
295
|
+
scope = instance_exec(*args, &scoping[:scope])
|
296
|
+
extension = scoping[:extension]
|
297
|
+
to_merge = scope || queryable
|
298
|
+
criteria = to_merge.empty_and_chainable? ? to_merge : with_default_scope.merge(to_merge)
|
299
|
+
criteria.extend(extension)
|
300
|
+
criteria
|
301
|
+
end
|
302
|
+
)
|
301
303
|
end
|
302
304
|
end
|
303
305
|
|
data/lib/mongoid/version.rb
CHANGED
@@ -85,8 +85,8 @@ describe Mongoid::Equality do
|
|
85
85
|
|
86
86
|
describe ".===" do
|
87
87
|
|
88
|
-
context "when legacy_triple_equals is set" do
|
89
|
-
config_override :legacy_triple_equals,
|
88
|
+
context "when legacy_triple_equals is not set" do
|
89
|
+
config_override :legacy_triple_equals, false
|
90
90
|
|
91
91
|
context "when comparable is an instance of this document" do
|
92
92
|
|
@@ -128,8 +128,8 @@ describe Mongoid::Equality do
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
context "when legacy_triple_equals is
|
132
|
-
config_override :legacy_triple_equals,
|
131
|
+
context "when legacy_triple_equals is set" do
|
132
|
+
config_override :legacy_triple_equals, true
|
133
133
|
|
134
134
|
context "when comparable is an instance of this document" do
|
135
135
|
|
@@ -205,8 +205,8 @@ describe Mongoid::Equality do
|
|
205
205
|
|
206
206
|
context "when the class is the same" do
|
207
207
|
|
208
|
-
it "returns
|
209
|
-
expect(person === Person).to be
|
208
|
+
it "returns true" do
|
209
|
+
expect(person === Person).to be true
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
@@ -219,8 +219,8 @@ describe Mongoid::Equality do
|
|
219
219
|
|
220
220
|
context "when the class is a superclass" do
|
221
221
|
|
222
|
-
it "returns
|
223
|
-
expect(Doctor.new === Person).to be
|
222
|
+
it "returns true" do
|
223
|
+
expect(Doctor.new === Person).to be true
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
@@ -256,8 +256,8 @@ describe Mongoid::Equality do
|
|
256
256
|
context "when comparing to a class" do
|
257
257
|
context "when the class is the same" do
|
258
258
|
|
259
|
-
it "returns
|
260
|
-
expect(person === Person).to be
|
259
|
+
it "returns false" do
|
260
|
+
expect(person === Person).to be false
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
@@ -270,8 +270,8 @@ describe Mongoid::Equality do
|
|
270
270
|
|
271
271
|
context "when the class is a superclass" do
|
272
272
|
|
273
|
-
it "returns
|
274
|
-
expect(Doctor.new === Person).to be
|
273
|
+
it "returns false" do
|
274
|
+
expect(Doctor.new === Person).to be false
|
275
275
|
end
|
276
276
|
end
|
277
277
|
end
|
@@ -481,27 +481,45 @@ describe Mongoid::Scopable do
|
|
481
481
|
|
482
482
|
context "when a block is provided" do
|
483
483
|
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
484
|
+
context "when with optional and keyword arguments" do
|
485
|
+
before do
|
486
|
+
Band.scope(:named_by, ->(name, deleted: false) {
|
487
|
+
Band.where(name: name, deleted: deleted)
|
488
|
+
})
|
489
489
|
end
|
490
|
-
end
|
491
490
|
|
492
|
-
|
493
|
-
|
494
|
-
undef_method :active
|
491
|
+
let(:scope) do
|
492
|
+
Band.named_by("Emily", deleted: true)
|
495
493
|
end
|
496
|
-
Band._declared_scopes.clear
|
497
|
-
end
|
498
494
|
|
499
|
-
|
500
|
-
|
495
|
+
it "sets the conditions from keyword arguments" do
|
496
|
+
scope.selector.should == {'name' => 'Emily', 'deleted' => true}
|
497
|
+
end
|
501
498
|
end
|
502
499
|
|
503
|
-
|
504
|
-
|
500
|
+
context "when without arguments" do
|
501
|
+
before do
|
502
|
+
Band.scope(:active, ->{ Band.where(active: true) }) do
|
503
|
+
def add_origin
|
504
|
+
tap { |c| c.selector[:origin] = "Deutschland" }
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|
508
|
+
|
509
|
+
after do
|
510
|
+
class << Band
|
511
|
+
undef_method :active
|
512
|
+
end
|
513
|
+
Band._declared_scopes.clear
|
514
|
+
end
|
515
|
+
|
516
|
+
let(:scope) do
|
517
|
+
Band.active.add_origin
|
518
|
+
end
|
519
|
+
|
520
|
+
it "adds the extension to the scope" do
|
521
|
+
expect(scope.selector).to eq({ "active" => true, "origin" => "Deutschland" })
|
522
|
+
end
|
505
523
|
end
|
506
524
|
end
|
507
525
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.5.
|
4
|
+
version: 7.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Durran Jordan
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
+WyKQ+QTIdtDiyf2LQmxWnxt/W1CmScjdLS7/yXGkkB/D9Uy+sJD747O/B9P238Q
|
31
31
|
XnerrtyOu04RsWDvaZkCwSDVzoqfICh4CP1mlde73Ts=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2022-07-
|
33
|
+
date: 2022-07-23 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: activemodel
|
metadata.gz.sig
CHANGED
Binary file
|