services 7.2.0 → 7.2.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
- data/lib/services.rb +2 -2
- data/lib/services/query.rb +4 -2
- data/lib/services/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27e5b3e8dcab03964af30636e451cef509b9155fa721e1323dafdf0ece173364
|
4
|
+
data.tar.gz: 76ad367be766868a392826d2b8600fbe96a97da1a42f4cda2f0a75ef64440f6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2302bdb005ff03507cb952a2feb4b9e7171f3e9823d151aacdc39528005c768780d10ad4e35d4fb283ca56d6666b8862ec08df0838a6b39db7a3beda64829a83
|
7
|
+
data.tar.gz: 6d55fd8fc4e2e1780343ff14ee56cd9ef89052620e187952a563a5aed0a3b82bad7871b170023d2c9f4cfb4929ea6df776e8e9dc2906fc5b1667d1c512b8ca11
|
data/lib/services.rb
CHANGED
@@ -18,8 +18,8 @@ module Services
|
|
18
18
|
@redis ||= self.configuration.redis || (defined?(Redis.current) && Redis.current) or fail RedisNotFound, 'Redis not configured.'
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.allow_class_method_in_queries(klass, method)
|
22
|
-
(configuration.allowed_class_methods_in_queries[klass.to_s] ||=
|
21
|
+
def self.allow_class_method_in_queries(klass, method, arity = nil)
|
22
|
+
(configuration.allowed_class_methods_in_queries[klass.to_s] ||= {})[method.to_sym] = arity
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
data/lib/services/query.rb
CHANGED
@@ -71,8 +71,10 @@ module Services
|
|
71
71
|
end
|
72
72
|
|
73
73
|
conditions.each do |k, v|
|
74
|
-
|
75
|
-
|
74
|
+
allowed_class_methods = Services.configuration.allowed_class_methods_in_queries[object_class.to_s]
|
75
|
+
if allowed_class_methods&.key?(k)
|
76
|
+
arity = allowed_class_methods[k] || object_class.method(k).arity
|
77
|
+
case arity
|
76
78
|
when 0
|
77
79
|
unless v == true
|
78
80
|
raise ArgumentError, "Method #{k} of class #{self} takes no arguments, so `true` must be passed as the value for this param, not #{v} (#{v.class})."
|
data/lib/services/version.rb
CHANGED