activestorage-after_analyze_attached 0.1.0 → 0.2.0

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: 6f44aaa9dd72737da7e125e5605caf5d1d603a3e21de7f948aacd9193e0be3f1
4
- data.tar.gz: e053f0e7f6e7e9a6b0600f04fcd528d69a1a23352ddde2e842b345573203d0a8
3
+ metadata.gz: 5122ca221d7fb657c4ed20ae62596c636149c855c233630485477f8d015d4ee2
4
+ data.tar.gz: 194ab602aa399ba701f182bd33df861627306605b42fd92fed95c4524a667205
5
5
  SHA512:
6
- metadata.gz: f6d238f23278a948c65877a8cc4cd772d106ec9c6010a5382e0b96183d82dffe8d1910ba4c830c69573619dc810f8ffc5a9c272b6a703141c9e391351922fa50
7
- data.tar.gz: 28e3f54ecfa8ac16899133cd490c09c0692c9de15c413e5c329b9ae32a285c810c4d8608345b0fb491b51c954a3f430aa545db8eee07e62817328a327501f377
6
+ metadata.gz: 3361c5177ca9d6694fafe391bda9013c15c56d07685e1db206d50c2dd404bd823f518dc967a180bc580fceff0d90d94e85931ae16b02627c2c68ff40a0c44ecd
7
+ data.tar.gz: 626e534f090e6233139598e182f21c0ef60ec9783e470313e5b5dd6636be5fcb494cd6d255cee80b868ad8d56b4ec01d171c8200c23ab913e7e98ae715e4f4e4
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Activestorage::AfterAnalyzeAttached
2
2
 
3
+ [![CI](https://github.com/frayzil/activestorage-after_analyze_attached/actions/workflows/ci.yml/badge.svg)](https://github.com/frayzil/activestorage-after_analyze_attached/actions/workflows/ci.yml)
4
+ [![Coverage](https://raw.githubusercontent.com/frayzil/activestorage-after_analyze_attached/main/.github/badges/coverage.svg)](https://github.com/frayzil/activestorage-after_analyze_attached/actions/workflows/ci.yml)
5
+
3
6
  A Rails gem that provides a callback for when Active Storage attachments are analyzed. This is particularly useful when you need to perform actions after Active Storage has analyzed an attachment, such as updating flags, triggering background jobs, or updating the UI.
4
7
 
5
8
  ## Why use this gem?
@@ -1,5 +1,5 @@
1
1
  module Activestorage
2
2
  module AfterAnalyzeAttached
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -28,12 +28,12 @@ module ActiveStorage::AfterAnalyzeAttached
28
28
  end
29
29
 
30
30
  def blob_analyzed(blob)
31
- after_analyze_attached_callbacks(blob).each { instance_eval(&_1) }
32
- end
33
-
34
- def after_analyze_attached_callbacks(blob)
35
- attachment_names = ActiveStorage::Attachment.where(blob: blob).pluck(:name).map(&:to_sym)
36
- attachment_names.flat_map { |name| self.class.after_analyze_attached_callbacks[name] }
31
+ attachments = ActiveStorage::Attachment.where(blob: blob)
32
+ attachments.each do |attachment|
33
+ attachment_name = attachment.name.to_sym
34
+ callbacks = self.class.after_analyze_attached_callbacks[attachment_name]
35
+ callbacks.each { |callback| instance_exec(attachment, blob, &callback) }
36
+ end
37
37
  end
38
38
  end
39
39
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage-after_analyze_attached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Syed Fazil Basheer
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-18 00:00:00.000000000 Z
10
+ date: 2025-04-20 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -24,6 +23,20 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: 8.0.1
26
+ - !ruby/object:Gem::Dependency
27
+ name: simplecov
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.22.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 0.22.0
27
40
  description: This gem extends ActiveStorage to provide an after_analyze callback that
28
41
  gets triggered after analyzing an attachment
29
42
  email:
@@ -47,7 +60,6 @@ metadata:
47
60
  homepage_uri: https://github.com/frayzil/activestorage-after_analyze_attached
48
61
  source_code_uri: https://github.com/frayzil/activestorage-after_analyze_attached
49
62
  changelog_uri: https://github.com/frayzil/activestorage-after_analyze_attached/blob/main/CHANGELOG.md
50
- post_install_message:
51
63
  rdoc_options: []
52
64
  require_paths:
53
65
  - lib
@@ -62,8 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
74
  - !ruby/object:Gem::Version
63
75
  version: '0'
64
76
  requirements: []
65
- rubygems_version: 3.5.11
66
- signing_key:
77
+ rubygems_version: 3.6.2
67
78
  specification_version: 4
68
79
  summary: Adds after_analyze callback to ActiveStorage attachments
69
80
  test_files: []