From 90a75bf64b61f9597b206af7226a7c379a0f1928 Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Tue, 29 Oct 2024 12:15:01 -0400 Subject: [PATCH] Fix deprecation warning by passing a deprecator Note, this deprecation was originally done for zeitwerk/namespace loading and should be removed soon. It was added originally in: 9e0de209885536af0532be3a0ee3f2d7f2c4f758 --- lib/manageiq/reporting/formatter.rb | 28 ++++++++++++++-------------- lib/vmdb/deprecation.rb | 1 + 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/manageiq/reporting/formatter.rb b/lib/manageiq/reporting/formatter.rb index ae94d645f92..97df803cb92 100644 --- a/lib/manageiq/reporting/formatter.rb +++ b/lib/manageiq/reporting/formatter.rb @@ -21,19 +21,19 @@ module Formatter # Deprecate the constants within ReportFormatter with a helpful replacement. module ReportFormatter include ActiveSupport::Deprecation::DeprecatedConstantAccessor - deprecate_constant :BLANK_VALUE, 'ManageIQ::Reporting::Formatter::BLANK_VALUE' - deprecate_constant :CRLF, 'ManageIQ::Reporting::Formatter::CRLF' - deprecate_constant :LABEL_LENGTH, 'ManageIQ::Reporting::Formatter::LABEL_LENGTH' - deprecate_constant :LEGEND_LENGTH, 'ManageIQ::Reporting::Formatter::LEGEND_LENGTH' + deprecate_constant :BLANK_VALUE, 'ManageIQ::Reporting::Formatter::BLANK_VALUE', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :CRLF, 'ManageIQ::Reporting::Formatter::CRLF', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :LABEL_LENGTH, 'ManageIQ::Reporting::Formatter::LABEL_LENGTH', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :LEGEND_LENGTH, 'ManageIQ::Reporting::Formatter::LEGEND_LENGTH', :deprecator => Vmdb::Deprecation.deprecator - deprecate_constant :C3Formatter, 'ManageIQ::Reporting::Formatter::C3' - deprecate_constant :C3Series, 'ManageIQ::Reporting::Formatter::C3Series' - deprecate_constant :C3Charting, 'ManageIQ::Reporting::Formatter::C3Charting' - deprecate_constant :ChartCommon, 'ManageIQ::Reporting::Formatter::ChartCommon' - deprecate_constant :Converter, 'ManageIQ::Reporting::Formatter::Converter' - deprecate_constant :ReportHTML, 'ManageIQ::Reporting::Formatter::Html' - deprecate_constant :ReportRenderer, 'ManageIQ::Reporting::Formatter::ReportRenderer' - deprecate_constant :ReportText, 'ManageIQ::Reporting::Formatter::Text' - deprecate_constant :ReportTimeline, 'ManageIQ::Reporting::Formatter::Timeline' - deprecate_constant :TimelineMessage, 'ManageIQ::Reporting::Formatter::TimelineMessage' + deprecate_constant :C3Formatter, 'ManageIQ::Reporting::Formatter::C3', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :C3Series, 'ManageIQ::Reporting::Formatter::C3Series', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :C3Charting, 'ManageIQ::Reporting::Formatter::C3Charting', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :ChartCommon, 'ManageIQ::Reporting::Formatter::ChartCommon', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :Converter, 'ManageIQ::Reporting::Formatter::Converter', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :ReportHTML, 'ManageIQ::Reporting::Formatter::Html', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :ReportRenderer, 'ManageIQ::Reporting::Formatter::ReportRenderer', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :ReportText, 'ManageIQ::Reporting::Formatter::Text', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :ReportTimeline, 'ManageIQ::Reporting::Formatter::Timeline', :deprecator => Vmdb::Deprecation.deprecator + deprecate_constant :TimelineMessage, 'ManageIQ::Reporting::Formatter::TimelineMessage', :deprecator => Vmdb::Deprecation.deprecator end diff --git a/lib/vmdb/deprecation.rb b/lib/vmdb/deprecation.rb index 9d547939adb..67f4270ac15 100644 --- a/lib/vmdb/deprecation.rb +++ b/lib/vmdb/deprecation.rb @@ -13,6 +13,7 @@ def self.respond_to_missing?(method, _include_private = false) end class << self + alias_method :deprecator, :instance delegate :silence, :warn, :to => :instance end