Module: ActiveSupport::Deprecation::Disallowed
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | activesupport/lib/active_support/deprecation/disallowed.rb |
Instance Attribute Summary
-
#disallowed_warnings
rw
Returns the configured criteria used to identify deprecation messages which should be treated as disallowed.
-
#disallowed_warnings=(value)
rw
Sets the criteria used to identify deprecation messages which should be disallowed.
Instance Method Summary
Instance Attribute Details
#disallowed_warnings (rw)
Returns the configured criteria used to identify deprecation messages which should be treated as disallowed.
# File 'activesupport/lib/active_support/deprecation/disallowed.rb', line 21
def disallowed_warnings @disallowed_warnings ||= [] end
#disallowed_warnings=(value) (rw)
Sets the criteria used to identify deprecation messages which should be disallowed. Can be an array containing strings, symbols, or regular expressions. (Symbols are treated as strings.) These are compared against the text of the generated deprecation warning.
Additionally the scalar symbol :all
may be used to treat all deprecations as disallowed.
Deprecations matching a substring or regular expression will be handled using the configured Behavior#disallowed_behavior rather than Behavior#behavior.
# File 'activesupport/lib/active_support/deprecation/disallowed.rb', line 17
attr_writer :disallowed_warnings
Instance Method Details
#deprecation_disallowed?(message) ⇒ Boolean
(private)
# File 'activesupport/lib/active_support/deprecation/disallowed.rb', line 26
def deprecation_disallowed?( ) return false if explicitly_allowed?( ) return true if disallowed_warnings == :all && disallowed_warnings.any? do |rule| case rule when String, Symbol .include?(rule.to_s) when Regexp rule.match?( ) end end end
#explicitly_allowed?(message) ⇒ Boolean
(private)
# File 'activesupport/lib/active_support/deprecation/disallowed.rb', line 39
def explicitly_allowed?( ) allowances = @explicitly_allowed_warnings.value return false unless allowances return true if allowances == :all && Array(allowances).any? do |rule| case rule when String, Symbol .include?(rule.to_s) when Regexp rule.match?( ) end end end