Class: Evilution::AST::ConstantNames Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/ast/constant_names.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.

Walks a Prism AST and returns every class/module constant declared, nested names rendered fully-qualified (e.g. "Foo::Bar"). Order is source order: outer declarations precede their nested children.

Instance Method Summary collapse

Instance Method Details

#call(source) ⇒ 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.



10
11
12
13
14
15
# File 'lib/evilution/ast/constant_names.rb', line 10

def call(source)
  result = Prism.parse(source)
  return [] if result.failure?

  collect(result.value)
end