active_storage_validations 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3a3eccb847537354b9018f239171e4b3bdf363991d68c57844d87ecd0c14fcd
4
- data.tar.gz: 432cfb9b3162db1d57446536de58d3b511c5a641d3da8c22123da56c877fd804
3
+ metadata.gz: 267c083e1e37ff53853d928bf3df0a69b8c9cf0662c3cf744f99cde3d5809125
4
+ data.tar.gz: 36554892e5c2df7ad812119b6acfae985e4adbe1dd8f7c29699f8f9ba69f0506
5
5
  SHA512:
6
- metadata.gz: '0697168d7d38d2974772a89e203861099bf5ac476e147dbc14826d1cee98271e3ded9789fd0ada073853d835658165141a596eeeb92af1cf52850d8c8f76c110'
7
- data.tar.gz: d9ad210e053d90e69df85a6ce21644ace0eb096376db6ff5c5b1e4fb31a6eff2d23db6000f1ef566fba33337d242b23b52dbdc9af481b10e9870248a88c15fac
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
  {}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageValidations
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.3'
5
5
  end
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.1
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-19 00:00:00.000000000 Z
11
+ date: 2022-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob