tanoshimu_utils 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tanoshimu_utils/concerns/resource_fetch.rb +6 -0
- data/lib/tanoshimu_utils/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: 0d89a89ee2a88ac4a6c6ba96c98a4b158d29fbd71ec306c1b2934d09e7cdf495
|
4
|
+
data.tar.gz: d2eea7a91e7fefc67beb18d1947e9a213700d6ac168c9bcdff25596860d97646
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05df987581a2076776af93969b5575ad5c379b895fbae54a5189b26944ea5c0ddc7f68ed5f4d20f15334533a494ab367143197da7020bd7d75ab21310623d62f
|
7
|
+
data.tar.gz: 4b4c0787f53d8577611e256d0caff4f37d1d802a220a6703dee1f7b51a1993c04f73b46413f55f29dfd292a5ae2c56d21a42f5e6048a18aaab6da1ba97a85f4b
|
@@ -33,6 +33,12 @@ module TanoshimuUtils
|
|
33
33
|
send(:define_method, "#{resource_name}?") do
|
34
34
|
(fetch!(resource_name, default_url)&.attached?).present?
|
35
35
|
end
|
36
|
+
send(:define_method, "generate_#{resource_name}_url!") do
|
37
|
+
return true if send("#{resource_url}?") && !force
|
38
|
+
|
39
|
+
new_url = send("#{resource_url}!")
|
40
|
+
new_url.present? && update(resource_url => new_url)
|
41
|
+
end
|
36
42
|
end
|
37
43
|
end
|
38
44
|
|