From 25469d9622947562a6a70f179a572b4ac8ba438f Mon Sep 17 00:00:00 2001 From: Joshua Young Date: Tue, 30 Apr 2024 13:24:01 +1000 Subject: [PATCH 1/2] Address `ActiveSupport::ProxyObject` deprecation on Rails 7.2.0.alpha --- lib/delayed/compatibility.rb | 12 ------------ lib/delayed/message_sending.rb | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/delayed/compatibility.rb b/lib/delayed/compatibility.rb index 72778f9cc..0ef949b7a 100644 --- a/lib/delayed/compatibility.rb +++ b/lib/delayed/compatibility.rb @@ -3,25 +3,13 @@ module Delayed module Compatibility if ActiveSupport::VERSION::MAJOR >= 4 - require 'active_support/proxy_object' - def self.executable_prefix 'bin' end - - def self.proxy_object_class - ActiveSupport::ProxyObject - end else - require 'active_support/basic_object' - def self.executable_prefix 'script' end - - def self.proxy_object_class - ActiveSupport::BasicObject - end end end end diff --git a/lib/delayed/message_sending.rb b/lib/delayed/message_sending.rb index a2808fd39..960b73d0d 100644 --- a/lib/delayed/message_sending.rb +++ b/lib/delayed/message_sending.rb @@ -1,5 +1,5 @@ module Delayed - class DelayProxy < Delayed::Compatibility.proxy_object_class + class DelayProxy < BasicObject def initialize(payload_class, target, options) @payload_class = payload_class @target = target From 21b3dad718549ca2600571004ac00960c498c46e Mon Sep 17 00:00:00 2001 From: David Genord II Date: Tue, 13 Aug 2024 11:05:35 -0400 Subject: [PATCH 2/2] Bring in missing functionality from ProxyObject --- lib/delayed/message_sending.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/delayed/message_sending.rb b/lib/delayed/message_sending.rb index 960b73d0d..6e1e834a1 100644 --- a/lib/delayed/message_sending.rb +++ b/lib/delayed/message_sending.rb @@ -1,5 +1,11 @@ module Delayed class DelayProxy < BasicObject + undef_method :== + undef_method :equal? + + # Let DelayProxy raise exceptions. + define_method(:raise, ::Object.instance_method(:raise)) + def initialize(payload_class, target, options) @payload_class = payload_class @target = target