Class: Google::Ads::GoogleAds::Deprecation
- Inherits:
-
Object
- Object
- Google::Ads::GoogleAds::Deprecation
- Defined in:
- lib/google/ads/google_ads/deprecation.rb
Constant Summary collapse
- Error =
Class.new(StandardError)
Instance Method Summary collapse
- #deprecate(deprecation) ⇒ Object
-
#initialize(treat_deprecation_warnings_as_errors, warn_on_all_deprecations) ⇒ Deprecation
constructor
A new instance of Deprecation.
Constructor Details
#initialize(treat_deprecation_warnings_as_errors, warn_on_all_deprecations) ⇒ Deprecation
Returns a new instance of Deprecation.
6 7 8 9 10 11 12 13 |
# File 'lib/google/ads/google_ads/deprecation.rb', line 6 def initialize( treat_deprecation_warnings_as_errors, warn_on_all_deprecations ) @treat_deprecation_warnings_as_errors = treat_deprecation_warnings_as_errors @warn_on_all_deprecations = warn_on_all_deprecations @silenced_sites = {} end |
Instance Method Details
#deprecate(deprecation) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/google/ads/google_ads/deprecation.rb', line 15 def deprecate(deprecation) return unless should_warn? if @treat_deprecation_warnings_as_errors raise Error, deprecation else Warning.warn("\n#{deprecation}. Called from: #{CallerFilter.first_non_google_ads_line}\n") end end |