diff options
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/prefer_class_methods_over_module.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/rubocop/cop/prefer_class_methods_over_module.rb b/rubocop/cop/prefer_class_methods_over_module.rb index ed10229b69a..5097dc7829d 100644 --- a/rubocop/cop/prefer_class_methods_over_module.rb +++ b/rubocop/cop/prefer_class_methods_over_module.rb @@ -48,7 +48,7 @@ module RuboCop private def extends_activesupport_concern?(node) - container_module = container_module_of(node.parent) + container_module = container_module_of(node) return false unless container_module container_module.descendants.any? do |descendant| @@ -57,7 +57,9 @@ module RuboCop end def container_module_of(node) - node = node.parent until node.type == :module + while node = node.parent + break if node.type == :module + end node end |