Skip to content

Commit 740011b

Browse files
committed
Remove potential reliance on ActiveSupport::Inflector#constantize
`constantize` is basically an alias for `Object.const_get`, so why are we doing gymnastics to avail ourselves of it? https://github.com/rails/rails/blob/cf6ff17e9a3c6c1139040b519a341f55f0be16cf/activesupport/lib/active_support/inflector/methods.rb#L289
1 parent 632768d commit 740011b

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

sentry-resque/lib/sentry/resque.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,8 @@ def record(queue, worker, payload, &block)
4040

4141
finish_transaction(transaction, 200)
4242
rescue Exception => exception
43-
klass = if payload["class"].respond_to?(:constantize)
44-
payload["class"].constantize
45-
else
46-
Object.const_get(payload["class"].to_s)
47-
end
43+
klass = payload["class"]
44+
klass = Object.const_get(klass) unless klass.is_a?(Class)
4845

4946
raise if Sentry.configuration.resque.report_after_job_retries &&
5047
defined?(::Resque::Plugins::Retry) == "constant" &&

0 commit comments

Comments
 (0)