lib/rubocop/cop/mixin/allowed_methods.rb in rubocop-1.32.0 vs lib/rubocop/cop/mixin/allowed_methods.rb in rubocop-1.33.0
- old
+ new
@@ -10,12 +10,26 @@
# @api public
def allowed_method?(name)
allowed_methods.include?(name.to_s)
end
+ # @deprecated Use allowed_method? instead
+ alias ignored_method? allowed_method?
+
# @api public
def allowed_methods
- cop_config.fetch('AllowedMethods', [])
+ deprecated_values = cop_config_deprecated_values
+ if deprecated_values.any?(Regexp)
+ cop_config.fetch('AllowedMethods', [])
+ else
+ Array(cop_config['AllowedMethods']).concat(deprecated_values)
+ end
end
+
+ def cop_config_deprecated_values
+ Array(cop_config['IgnoredMethods']).concat(Array(cop_config['ExcludedMethods']))
+ end
end
+ # @deprecated IgnoredMethods class has been replaced with AllowedMethods.
+ IgnoredMethods = AllowedMethods
end
end