Class: Evilution::Mutator::Operator::MixinRemoval::ScopeFinder Private

Inherits:
Prism::Visitor
  • Object
show all
Defined in:
lib/evilution/mutator/operator/mixin_removal.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Visitor to find the ClassNode or ModuleNode enclosing a given line number.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_line) ⇒ ScopeFinder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ScopeFinder.



72
73
74
75
# File 'lib/evilution/mutator/operator/mixin_removal.rb', line 72

def initialize(target_line)
  @target_line = target_line
  @result = nil
end

Instance Attribute Details

#resultObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



70
71
72
# File 'lib/evilution/mutator/operator/mixin_removal.rb', line 70

def result
  @result
end

Instance Method Details

#visit_class_node(node) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



77
78
79
80
# File 'lib/evilution/mutator/operator/mixin_removal.rb', line 77

def visit_class_node(node)
  @result = node if @target_line.between?(node.location.start_line, node.location.end_line)
  super
end

#visit_module_node(node) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



82
83
84
85
# File 'lib/evilution/mutator/operator/mixin_removal.rb', line 82

def visit_module_node(node)
  @result = node if @target_line.between?(node.location.start_line, node.location.end_line)
  super
end