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:
self,
VisibilityHelp
|
|
Defined in: | lib/rubocop/cop/mixin/def_node.rb |
Overview
Common functionality for checking def nodes.
Constant Summary
VisibilityHelp
- Included
Instance Method Summary
- #non_public?(node) ⇒ Boolean private
- #non_public_modifier?(node) private
- #preceding_non_public_modifier?(node) ⇒ Boolean private
VisibilityHelp
- Included
Instance Method Details
#non_public?(node) ⇒ Boolean
(private)
# 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)
# File 'lib/rubocop/cop/mixin/def_node.rb', line 16
def preceding_non_public_modifier?(node) node_visibility(node) != :public end