mongoid_ability 0.3.4 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c507aee422f260d41b3362fdaab309fcaaec4b6d
4
- data.tar.gz: 64cfd77de7d1498dde919e10e3639c7d8be4d668
3
+ metadata.gz: 7cececf7c6d06e78a0352d1d25585e9015da3435
4
+ data.tar.gz: 3c2c4e2bf689af0ff65b39c9e6756aca7fba1261
5
5
  SHA512:
6
- metadata.gz: 719e74564b155969eb8873e216e52c85756b82ccbc04573dda5b4ea66c80138c7e1596325daa51dfc15495b3e528db1602ad3c89eea5485170d45cb8bb5df27c
7
- data.tar.gz: bebec4577d5ef119322b2c9ac30b83a42cd4dc73fd62b0faabd95e686c212741420f0e19eaf964991008c7aba39488534f47bf8ec573e7d22f390e287f6a09fc
6
+ metadata.gz: a4158f26b3ee625ecbac3eee508a8ff310cd35232d9f4af8ae6d7e15e051ca49174a12ddaa279e4bfd785163a7405449e9a14d7fb038685219153b3db2982413
7
+ data.tar.gz: 11d07ad4dc0b89615ccafb366623a2e756deca09d27b5e194d0344684936906762bd39fadb1e9e35ce235a0bd643fc9fe30e1a683839ece649e501ac22b89e60
@@ -8,21 +8,25 @@ module MongoidAbility
8
8
 
9
9
  def call
10
10
  return base_class.criteria unless and_conditions.present?
11
- base_class.criteria.where(and_conditions)
11
+ base_class.criteria.where(conditions)
12
12
  end
13
13
 
14
- private # =============================================================
15
-
16
- def or_conditions
17
- return unless conditions = [closed_types_condition, open_ids_condition].compact.presence
18
- { :$or => conditions }
14
+ def conditions
15
+ and_conditions
19
16
  end
20
17
 
18
+ private # =============================================================
19
+
21
20
  def and_conditions
22
21
  return unless conditions = [or_conditions, closed_ids_condition].compact.presence
23
22
  { :$and => conditions }
24
23
  end
25
24
 
25
+ def or_conditions
26
+ return unless conditions = [closed_types_condition, open_ids_condition].compact.presence
27
+ { :$or => conditions }
28
+ end
29
+
26
30
  def closed_types_condition
27
31
  return unless values.closed_types.present?
28
32
  { :_type.nin => values.closed_types }
@@ -1,3 +1,3 @@
1
1
  module MongoidAbility
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_ability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Celizna