MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / isRubyConstantPath

Function isRubyConstantPath

src/extraction/tree-sitter.ts:334–339  ·  view source on GitHub ↗

* A Ruby constant, or a `scope_resolution` path of constants (`A::B::C`, a * top-level `::A` / `::A::B`): what Ruby reads as a constant. A path through * a value (`obj::Thing`, `self.class::LIMIT`) is not one.

(node: SyntaxNode)

Source from the content-addressed store, hash-verified

332 * a value (`obj::Thing`, `self.class::LIMIT`) is not one.
333 */
334function isRubyConstantPath(node: SyntaxNode): boolean {
335 if (node.type === 'constant') return true;
336 if (node.type !== 'scope_resolution') return false;
337 const scope = getChildByField(node, 'scope');
338 return getChildByField(node, 'name')?.type === 'constant' && (!scope || isRubyConstantPath(scope));
339}
340
341/**
342 * The class a Ruby call receiver constructs, as written: `Foo` for

Callers 2

rubyConstructedClassFunction · 0.85
extractCallMethod · 0.85

Calls 1

getChildByFieldFunction · 0.90

Tested by

no test coverage detected