Module: Hashira::Smells::Scope
- Defined in:
- lib/hashira/smells/scope.rb
Constant Summary collapse
- TYPES =
[Prism::ClassNode, Prism::ModuleNode, Prism::SingletonClassNode].freeze
- FENCES =
(TYPES + [Prism::DefNode]).freeze
Class Method Summary collapse
- .below(root, fences) ⇒ Object
- .inside(node) ⇒ Object
- .sweep(node) ⇒ Object
- .visit(root, fences) ⇒ Object
Class Method Details
.below(root, fences) ⇒ Object
16 17 18 19 20 |
# File 'lib/hashira/smells/scope.rb', line 16 def below(root, fences) found = [] visit(root, fences) { found << it } found end |
.inside(node) ⇒ Object
12 |
# File 'lib/hashira/smells/scope.rb', line 12 def inside(node) = below(node, FENCES) |
.sweep(node) ⇒ Object
14 |
# File 'lib/hashira/smells/scope.rb', line 14 def sweep(node) = below(node, TYPES) |