Module: RuboCop::Cop::ForbiddenPattern
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
| |
| Defined in: | lib/rubocop/cop/mixin/forbidden_pattern.rb |
Overview
This module encapsulates the ability to forbid certain patterns in a cop.
Instance Method Summary
Instance Method Details
#forbidden_pattern?(name) ⇒ Boolean
# File 'lib/rubocop/cop/mixin/forbidden_pattern.rb', line 7
def forbidden_pattern?(name) forbidden_pattern_regexps.any? { |pattern| pattern.match?(name) } end
#forbidden_pattern_regexps
[ GitHub ]# File 'lib/rubocop/cop/mixin/forbidden_pattern.rb', line 15
def forbidden_pattern_regexps @forbidden_pattern_regexps ||= forbidden_patterns.map { |pattern| Regexp.new(pattern) } end
#forbidden_patterns
[ GitHub ]# File 'lib/rubocop/cop/mixin/forbidden_pattern.rb', line 11
def forbidden_patterns cop_config.fetch('ForbiddenPatterns', []) end