active_storage_validations 1.0.1 → 1.0.3
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: 267c083e1e37ff53853d928bf3df0a69b8c9cf0662c3cf744f99cde3d5809125
|
|
4
|
+
data.tar.gz: 36554892e5c2df7ad812119b6acfae985e4adbe1dd8f7c29699f8f9ba69f0506
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6cbe5d7521afc8680a9df584968c4e3da7c5e1602efc30f60dc6890a54bb9d609daf7e7eaa0924d6d7971f13e9c763e4063c228d14645b8c5261f1702c4a21c9
|
|
7
|
+
data.tar.gz: 989e058c095e07790f647af2582355dddd715101b6dce10d4b521865362c5857f8df869270ae88e5eb58d20fa698ed470f4b181517ac016439d45f0e30049e21
|
data/README.md
CHANGED
|
@@ -314,9 +314,9 @@ end
|
|
|
314
314
|
|
|
315
315
|
To run tests in root folder of gem:
|
|
316
316
|
|
|
317
|
-
* `BUNDLE_GEMFILE=gemfiles/rails_5_2.gemfile bundle exec rake test` to run for Rails 5.2
|
|
318
317
|
* `BUNDLE_GEMFILE=gemfiles/rails_6_0.gemfile bundle exec rake test` to run for Rails 6.0
|
|
319
318
|
* `BUNDLE_GEMFILE=gemfiles/rails_6_1.gemfile bundle exec rake test` to run for Rails 6.1
|
|
319
|
+
* `BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle exec rake test` to run for Rails 7.0
|
|
320
320
|
* `BUNDLE_GEMFILE=gemfiles/rails_next.gemfile bundle exec rake test` to run for Rails main branch
|
|
321
321
|
|
|
322
322
|
Snippet to run in console:
|
|
@@ -19,13 +19,11 @@ module ActiveStorageValidations
|
|
|
19
19
|
|
|
20
20
|
def allowing(*types)
|
|
21
21
|
@allowed_types = types.flatten
|
|
22
|
-
either_allowing_or_rejecting
|
|
23
22
|
self
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
def rejecting(*types)
|
|
27
26
|
@rejected_types = types.flatten
|
|
28
|
-
either_allowing_or_rejecting
|
|
29
27
|
self
|
|
30
28
|
end
|
|
31
29
|
|
|
@@ -52,12 +50,6 @@ module ActiveStorageValidations
|
|
|
52
50
|
|
|
53
51
|
protected
|
|
54
52
|
|
|
55
|
-
def either_allowing_or_rejecting
|
|
56
|
-
if @allowed_types && @rejected_types
|
|
57
|
-
raise ArgumentError, "You must specify either allowing or rejecting"
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
53
|
def responds_to_methods
|
|
62
54
|
@subject.respond_to?(@attribute_name) &&
|
|
63
55
|
@subject.public_send(@attribute_name).respond_to?(:attach) &&
|
|
@@ -90,7 +90,7 @@ module ActiveStorageValidations
|
|
|
90
90
|
|
|
91
91
|
|
|
92
92
|
raise InvalidImageError unless valid_image?(image)
|
|
93
|
-
yield image
|
|
93
|
+
yield image if block_given?
|
|
94
94
|
rescue LoadError, NameError
|
|
95
95
|
logger.info "Skipping image analysis because the mini_magick or ruby-vips gem isn't installed"
|
|
96
96
|
{}
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_storage_validations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Igor Kasyanchuk
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-10-
|
|
11
|
+
date: 2022-10-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activejob
|