Skip to content

Commit

Permalink
♻️ Push members down now that there is only one subclass
Browse files Browse the repository at this point in the history
  • Loading branch information
jcroteau committed Jul 31, 2024
1 parent 0c69d58 commit f92e77a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
23 changes: 0 additions & 23 deletions app/services/deprecation_warnings/base_handler.rb

This file was deleted.

13 changes: 10 additions & 3 deletions app/services/deprecation_warnings/production_handler.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# frozen_string_literal: true

require_relative "base_handler"

# @note For use with `ActiveSupport::Deprecation.behavior=` or `Rails.application.config.active_support.deprecation=`
module DeprecationWarnings
class ProductionHandler < BaseHandler
class ProductionHandler
APP_NAME = "caseflow"
SLACK_ALERT_TITLE = "Deprecation Warning - #{APP_NAME} (#{ENV['DEPLOY_ENV']})"
SLACK_ALERT_CHANNEL = "#appeals-deprecation-alerts"

class << self
# Adhere to `.call` signature expected by `ActiveSupport::Deprecation.behavior=`.
# https://github.com/rails/rails/blob/a4581b53aae93a8dd3205abae0630398cbce9204/activesupport/lib/active_support/deprecation/behaviors.rb#L70-L71
# :reek:LongParameterList
def call(message, callstack, deprecation_horizon, gem_name)
emit_warning_to_sentry(message, callstack, deprecation_horizon, gem_name)
Expand All @@ -18,6 +18,13 @@ def call(message, callstack, deprecation_horizon, gem_name)
Raven.capture_exception(error)
end

# Must respond to `.arity` to play nice with `ActiveSupport::Deprecation.behavior=`
# and return number of arguments accepted by `.call`.
# https://github.com/rails/rails/blob/a4581b53aae93a8dd3205abae0630398cbce9204/activesupport/lib/active_support/deprecation/behaviors.rb#L101
def arity
method(:call).arity
end

private

# :reek:LongParameterList
Expand Down

0 comments on commit f92e77a

Please sign in to comment.