Class: Evilution::AST::SubjectFinder Private

Inherits:
Prism::Visitor
  • Object
show all
Defined in:
lib/evilution/ast/parser.rb

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, file_path) ⇒ SubjectFinder

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



37
38
39
40
41
42
# File 'lib/evilution/ast/parser.rb', line 37

def initialize(source, file_path)
  @source = source
  @file_path = file_path
  @subjects = []
  @context = []
end

Instance Attribute Details

#subjectsObject (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.



35
36
37
# File 'lib/evilution/ast/parser.rb', line 35

def subjects
  @subjects
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.



50
51
52
53
54
# File 'lib/evilution/ast/parser.rb', line 50

def visit_class_node(node)
  @context.push(constant_name(node.constant_path))
  super
  @context.pop
end

#visit_def_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.



56
57
58
59
60
# File 'lib/evilution/ast/parser.rb', line 56

def visit_def_node(node)
  separator = node.receiver ? "." : "#"
  add_subject(node, separator)
  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.



44
45
46
47
48
# File 'lib/evilution/ast/parser.rb', line 44

def visit_module_node(node)
  @context.push(constant_name(node.constant_path))
  super
  @context.pop
end