Class: Evilution::Mutator::Operator::SuperclassRemoval::ClassFinder Private

Inherits:
Prism::Visitor
  • Object
show all
Defined in:
lib/evilution/mutator/operator/superclass_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 enclosing a given line number.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_line) ⇒ ClassFinder

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 ClassFinder.



62
63
64
65
# File 'lib/evilution/mutator/operator/superclass_removal.rb', line 62

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.



60
61
62
# File 'lib/evilution/mutator/operator/superclass_removal.rb', line 60

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.



67
68
69
70
# File 'lib/evilution/mutator/operator/superclass_removal.rb', line 67

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