Skip to content

Commit

Permalink
Remove suppress_deprecations behavior
Browse files Browse the repository at this point in the history
`suppress_deprecations` options is no more required, because the
ActiveSupport::Deprecation#behavior can be configured as an array, and
accepts an array of Behaviors to handle the deprecation warning

https://api.rubyonrails.org/classes/ActiveSupport/Deprecation/Behavior.html#method-i-behavior-3D
  • Loading branch information
DanielePalombo committed Jul 31, 2023
1 parent ac43a87 commit 825a63f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/deprecations_detector/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module DeprecationsDetector
class Main
include Singleton

attr_reader :coverage_matrix, :deprecation_matrix, :suppress_deprecations
attr_reader :coverage_matrix, :deprecation_matrix
attr_accessor :config, :output_path

def initialize
Expand Down Expand Up @@ -51,9 +51,7 @@ def add_deprecation(message, callstack)
@deprecation_matrix[file_path][result[2].to_i - 1] = message
end

def start(suppress_deprecations: false)
@suppress_deprecations = suppress_deprecations

def start
@coverage_matrix = {}
@deprecation_matrix = {}
end
Expand Down
4 changes: 3 additions & 1 deletion spec/faked_project/lib/faked_project/some_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ def initialize(label)
end

def reverse
ActiveSupport::Deprecation.warn('My Deprecation')
deprecator = ActiveSupport::Deprecation.new
deprecator.behavior = DeprecationsDetector::Collect
deprecator.warn('My Deprecation')

label.reverse
end
Expand Down

0 comments on commit 825a63f

Please sign in to comment.