kithe 2.19.0 → 2.19.2

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: 675e05528a33eb6b29c34c8a3c55f19ba82b937d0eb41b61fcc632af0383dee1
4
- data.tar.gz: 43fd9b34e684e369e910e295d1bca21a00c53c10b0fa2cec0a74323351b09382
3
+ metadata.gz: bf141e03fcc8d69bf947402896f692127a16ef063d783543f3cae16cd710c01f
4
+ data.tar.gz: 61e074411a3274f8ab6bb8ebf2aa378deb6dc243b89aa21d0a9702c53a548aed
5
5
  SHA512:
6
- metadata.gz: e575adc1d2ae9ab6b7f78d2938468c696a1a5fd37a2d964b1a09ab0b3ef0b85ed15ad25bb4946e6069a79d043efb08449e72203281978617eca3ec5e5eb1343e
7
- data.tar.gz: 0a645f019d8ff8246d07cc29be08d937e9a2af40974746c557973a907aa36ba0be53cf0b75983a044b30899099fda6ebbfd637c25c48a15d2db2d3c19c969ec4
6
+ metadata.gz: ff9634bd6bd8123010f9cc746225391ad6c3c07bff53b11ba852cf473633624121ec0b4a505fa6484e7e6eea994288f2bde2bcd94a398db8a753a0aad77be4c5
7
+ data.tar.gz: 5d212aa1b7260171dc649b5e5a928aafd5060b1a349c82c716291c2d7e0c520927ebb661835e1bfe3b49ac700fd5c834914bf0bb67c69ba75dbb5afd9aa23d6a
@@ -41,13 +41,12 @@ class Kithe::Asset::DerivativeDefinition
41
41
  def applies_to_content_type?(original_content_type)
42
42
  return true if content_type.nil?
43
43
 
44
- return true if content_type == original_content_type
45
-
46
44
  return false if original_content_type.nil?
47
45
 
48
- return true if (content_type.kind_of?(Array) && content_type.include?(original_content_type))
49
-
50
- content_type == original_content_type.sub(%r{/.+\Z}, '')
46
+ return Array(content_type).find do |requested_type|
47
+ requested_type == original_content_type ||
48
+ requested_type == original_content_type.sub(%r{/.+\Z}, '')
49
+ end.present?
51
50
  end
52
51
 
53
52
  private
@@ -189,9 +189,23 @@ class Kithe::Model < ActiveRecord::Base
189
189
  # confusingly in this state, we need prepend FALSE to have this new callback be registered to go
190
190
  # FIRST. And this actually is correct and works whether or not run_after_transaction_callbacks_in_order_defined
191
191
  # Very confusing, we test thorougly.
192
- set_options_for_callbacks!(args, {prepend: false})
192
+ #
193
+ #
194
+ # We used to call ActiveRecord's private set_options_for_callbacks! to do this, but its
195
+ # signature changed incompatibly in a Rails 8.1 patch release. So we use only public
196
+ # API, plus the stable (but private) instance method transaction_include_any_action?
197
+ # to implement the `on:` option.
198
+ options = args.extract_options!.merge(prepend: false)
199
+
200
+ if options[:on]
201
+ fire_on = Array(options.delete(:on))
202
+ options[:if] = [
203
+ -> { transaction_include_any_action?(fire_on) },
204
+ *options[:if]
205
+ ]
206
+ end
193
207
 
194
- set_callback(:commit, :after, *args, &block)
208
+ set_callback(:commit, :after, *args, options, &block)
195
209
  end
196
210
 
197
211
  private
data/lib/kithe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kithe
2
- VERSION = '2.19.0'
2
+ VERSION = '2.19.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kithe
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.0
4
+ version: 2.19.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind