123456789_123456789_123456789_123456789_123456789_

Module: RuboCop::Cop::DefNode

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Macros
Instance Chain:
Defined in: lib/rubocop/cop/mixin/def_node.rb

Overview

Common functionality for checking def nodes.

Constant Summary

VisibilityHelp - Included

VISIBILITY_SCOPES

Instance Method Summary

Instance Method Details

#non_public?(node) ⇒ Boolean (private)

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/def_node.rb', line 12

def non_public?(node)
  non_public_modifier?(node.parent) || preceding_non_public_modifier?(node)
end

#non_public_modifier?(node) (private)

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/def_node.rb', line 21

def_node_matcher :non_public_modifier?, <<~PATTERN
  (send nil? {:private :protected :private_class_method} ({def defs} ...))
PATTERN

#preceding_non_public_modifier?(node) ⇒ Boolean (private)

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/def_node.rb', line 16

def preceding_non_public_modifier?(node)
  node_visibility(node) != :public
end