active_storage_validations 0.9.4 → 0.9.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 +4 -4
- data/README.md +3 -2
- data/config/locales/en.yml +0 -0
- data/config/locales/nl.yml +0 -0
- data/config/locales/pl.yml +0 -0
- data/config/locales/ru.yml +0 -0
- data/config/locales/uk.yml +0 -0
- data/lib/active_storage_validations.rb +0 -0
- data/lib/active_storage_validations/aspect_ratio_validator.rb +0 -0
- data/lib/active_storage_validations/content_type_validator.rb +4 -5
- data/lib/active_storage_validations/dimension_validator.rb +0 -0
- data/lib/active_storage_validations/limit_validator.rb +0 -0
- data/lib/active_storage_validations/matchers/content_type_validator_matcher.rb +1 -1
- data/lib/active_storage_validations/matchers/dimension_validator_matcher.rb +0 -0
- data/lib/active_storage_validations/matchers/size_validator_matcher.rb +0 -0
- data/lib/active_storage_validations/metadata.rb +0 -0
- data/lib/active_storage_validations/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efa69aeeea1b171286c6ca464e38146dedef79d22853c35ec6ea0ce0ca089812
|
4
|
+
data.tar.gz: e186561942afb6b295839565323d0bbed704de9e413b79ecc1fb194ada643ca5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c31ec657e1121427f19d7617d5efbeab639c6ebd87c0333c36510064e7b4d8125ffd8e4f5afa86121e626dd608d2ad1b859a3515c8bc7683e0793291a30c7fd2
|
7
|
+
data.tar.gz: 3141abc08b6b33d90f9874a74e93f6aaddb0ebbd52bdd36ee292a1e0ff7d37cf65a8ced082d316f48cc8e0132320c4f83304d9823971906526096264129c0145
|
data/README.md
CHANGED
@@ -58,14 +58,14 @@ end
|
|
58
58
|
|
59
59
|
### More examples
|
60
60
|
|
61
|
-
- Content type validation using symbols. In order to infer the correct mime type from the symbol, the types must be registered with `
|
61
|
+
- Content type validation using symbols. In order to infer the correct mime type from the symbol, the types must be registered with `MimeMagic::EXTENSIONS`.
|
62
62
|
|
63
63
|
```ruby
|
64
64
|
class User < ApplicationRecord
|
65
65
|
has_one_attached :avatar
|
66
66
|
has_many_attached :photos
|
67
67
|
|
68
|
-
validates :avatar, attached: true, content_type: :png #
|
68
|
+
validates :avatar, attached: true, content_type: :png # MimeMagic.by_extension(:png).to_s => 'image/png'
|
69
69
|
# or
|
70
70
|
validates :photos, attached: true, content_type: [:png, :jpg, :jpeg]
|
71
71
|
# or
|
@@ -343,6 +343,7 @@ You are welcome to contribute.
|
|
343
343
|
- https://github.com/dolarsrg
|
344
344
|
- https://github.com/jayshepherd
|
345
345
|
- https://github.com/ohbarye
|
346
|
+
- https://github.com/randsina
|
346
347
|
- https://github.com/...
|
347
348
|
|
348
349
|
## License
|
data/config/locales/en.yml
CHANGED
File without changes
|
data/config/locales/nl.yml
CHANGED
File without changes
|
data/config/locales/pl.yml
CHANGED
File without changes
|
data/config/locales/ru.yml
CHANGED
File without changes
|
data/config/locales/uk.yml
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -20,14 +20,13 @@ module ActiveStorageValidations
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def types
|
23
|
-
|
23
|
+
return @types if defined? @types
|
24
|
+
|
25
|
+
@types = (Array.wrap(options[:with]) + Array.wrap(options[:in])).compact.map do |type|
|
24
26
|
if type.is_a?(Regexp)
|
25
27
|
type
|
26
|
-
elsif type.is_a?(String) && type =~ %r{\A\w+/[-+.\w]+\z} # mime-type-ish string
|
27
|
-
type
|
28
28
|
else
|
29
|
-
|
30
|
-
" supported mime types (e.g. :png, 'jpg'), or mime type String ('image/jpeg')")
|
29
|
+
Marcel::MimeType.for(declared_type: type.to_s, extension: type.to_s)
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|