mongoid-collection-separated 0.3.0 → 0.3.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaeca25cec0e6b9f7eb25b233a73b0d795bb6ce6ba40e6108f87a7f9dfa80c8a
|
4
|
+
data.tar.gz: 82f28eaba1b9f99b3d40821cc2a5c05df050e457c235894b9bf53fed63cf573f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df796bad56cb2c450ce688091b5145e188c6f32e34592a9f4988c0d466e4d74d6c9fceca50f9abb5483f1ac58ddf6a10f602c34131ac9483a9bdce27533879c
|
7
|
+
data.tar.gz: 802d77484471bcccff19959901d876caa610fd726c93823a01e0773ad4c3a68030602bdf9d9efddbd4d8832615f7425d1e9cad43d3ef255fd193d495e463f209
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -18,12 +18,6 @@ module Mongoid
|
|
18
18
|
@calc_collection_name_fun = calc_collection_name_fun
|
19
19
|
end
|
20
20
|
|
21
|
-
def ensure_collection_name separate_key
|
22
|
-
cache_key = "#{__method__}_#{separate_key}"
|
23
|
-
return instance_variable_get "@#{cache_key}" if instance_variable_defined? "@#{cache_key}"
|
24
|
-
collection_name = self.send(self.send(:calc_collection_name_fun), separate_key)
|
25
|
-
instance_variable_set "@#{cache_key}", collection_name
|
26
|
-
end
|
27
21
|
end
|
28
22
|
|
29
23
|
end
|
@@ -21,7 +21,12 @@ module Mongoid
|
|
21
21
|
def calc_new_collection_name query_class
|
22
22
|
return unless query_class.respond_to?(:separated_field) && query_class.send(:separated_field).present?
|
23
23
|
return unless query_class.respond_to?(:calc_collection_name_fun) && query_class.respond_to?(query_class.calc_collection_name_fun)
|
24
|
-
|
24
|
+
separated_key = separated_value(query_class)
|
25
|
+
cache_key = "#{__method__}_#{separated_key}"
|
26
|
+
return instance_variable_get "@#{cache_key}" if instance_variable_defined? "@#{cache_key}"
|
27
|
+
collection_name = query_class.send(query_class.calc_collection_name_fun, separated_key)
|
28
|
+
instance_variable_set "@#{cache_key}", collection_name
|
29
|
+
collection_name
|
25
30
|
end
|
26
31
|
|
27
32
|
def separated_value query_class
|
@@ -80,7 +85,12 @@ module Mongoid
|
|
80
85
|
end
|
81
86
|
|
82
87
|
def calc_new_collection_name query_class
|
83
|
-
|
88
|
+
separated_key = base.send(query_class.separated_parent_field)
|
89
|
+
cache_key = "#{__method__}_#{separated_key}"
|
90
|
+
return instance_variable_get "@#{cache_key}" if instance_variable_defined? "@#{cache_key}"
|
91
|
+
collection_name = query_class.send(query_class.calc_collection_name_fun, separated_key)
|
92
|
+
instance_variable_set "@#{cache_key}", collection_name
|
93
|
+
collection_name
|
84
94
|
end
|
85
95
|
|
86
96
|
alias_method :criteria_without_separated, :criteria
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-collection-separated
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aibotyu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|