Module: RuboCop::Cop::IgnoredMethods
- Included in:
- Lint::NumberConversion, MethodComplexity, Metrics::BlockLength, Metrics::MethodLength, Style::BlockDelimiters, Style::ClassEqualityComparison, Style::MethodCallWithArgsParentheses, Style::MethodCallWithoutArgsParentheses, Style::NumericPredicate, Style::SymbolProc
- Defined in:
- lib/rubocop/cop/mixin/ignored_methods.rb
Overview
This module encapsulates the ability to ignore certain methods when parsing. Cops that use `IgnoredMethods` can accept either strings or regexes to match against.
Defined Under Namespace
Modules: Config
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
21 22 23 |
# File 'lib/rubocop/cop/mixin/ignored_methods.rb', line 21 def self.included(base) base.extend(Config) end |
Instance Method Details
#ignored_method?(name) ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rubocop/cop/mixin/ignored_methods.rb', line 25 def ignored_method?(name) ignored_methods.any? do |value| case value when Regexp value.match? String(name) else value == String(name) end end end |
#ignored_methods ⇒ Object
36 37 38 39 40 41 |
# File 'lib/rubocop/cop/mixin/ignored_methods.rb', line 36 def ignored_methods keys = %w[IgnoredMethods] keys << deprecated_key if deprecated_key cop_config.slice(*keys).values.reduce(&:concat) end |