Module: RuboCop::Cop::AllowedMethods
Overview
This module encapsulates the ability to allow certain methods when parsing. Even if the code is in offense, if it contains methods that are allowed. This module is equivalent to the IgnoredMethods module, which will be deprecated in RuboCop 2.0.
Instance Method Summary
- #allowed_method?(name) ⇒ Boolean (also: #ignored_method?) private
- #allowed_methods private
- #cop_config_allowed_methods private
- #cop_config_deprecated_values private
-
#ignored_method?(name)
private
Alias for #allowed_method?.
Instance Method Details
#allowed_method?(name) ⇒ Boolean
(private)
Also known as: #ignored_method?
# File 'lib/rubocop/cop/mixin/allowed_methods.rb', line 13
def allowed_method?(name) allowed_methods.include?(name.to_s) end
#allowed_methods (private)
[ GitHub ]# File 'lib/rubocop/cop/mixin/allowed_methods.rb', line 21
def allowed_methods if cop_config_deprecated_values.any?(Regexp) cop_config_allowed_methods else cop_config_allowed_methods + cop_config_deprecated_values end end
#cop_config_allowed_methods (private)
[ GitHub ]# File 'lib/rubocop/cop/mixin/allowed_methods.rb', line 29
def cop_config_allowed_methods @cop_config_allowed_methods ||= Array(cop_config.fetch('AllowedMethods', [])) end
#cop_config_deprecated_values (private)
[ GitHub ]# File 'lib/rubocop/cop/mixin/allowed_methods.rb', line 33
def cop_config_deprecated_values @cop_config_deprecated_values ||= Array(cop_config.fetch('IgnoredMethods', [])) + Array(cop_config.fetch('ExcludedMethods', [])) end
#ignored_method?(name) (private)
Alias for #allowed_method?.
# File 'lib/rubocop/cop/mixin/allowed_methods.rb', line 18
alias ignored_method? allowed_method?