allow
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (-38)
- 7.1.3.4 (0)
- What's this?
allow(allowed_warnings = :all, if: true, &block)
public
Allow previously disallowed deprecation warnings within the block. allowed_warnings can be an array containing strings, symbols, or regular expressions. (Symbols are treated as strings). These are compared against the text of deprecation warning messages generated within the block. Matching warnings will be exempt from the rules set by +ActiveSupport::Deprecation.disallowed_warnings+
The optional if: argument accepts a truthy/falsy value or an object that responds to .call. If truthy, then matching warnings will be allowed. If falsey then the method yields to the block without allowing the warning.
ActiveSupport::Deprecation.disallowed_behavior = :raise ActiveSupport::Deprecation.disallowed_warnings = [ "something broke" ] ActiveSupport::Deprecation.warn('something broke!') # => ActiveSupport::DeprecationException ActiveSupport::Deprecation.allow ['something broke'] do ActiveSupport::Deprecation.warn('something broke!') end # => nil ActiveSupport::Deprecation.allow ['something broke'], if: Rails.env.production? do ActiveSupport::Deprecation.warn('something broke!') end # => ActiveSupport::DeprecationException for dev/test, nil for production