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

Function resolveHelper

src/resolution/frameworks/ruby.ts:462–477  ·  view source on GitHub ↗
(name: string, context: ResolutionContext)

Source from the content-addressed store, hash-verified

460}
461
462function resolveHelper(name: string, context: ResolutionContext): string | null {
463 const snakeName = name.replace(/([A-Z])/g, '_$1').toLowerCase().slice(1);
464 const helperPath = `app/helpers/${snakeName}.rb`;
465
466 if (context.fileExists(helperPath)) {
467 const nodes = context.getNodesInFile(helperPath);
468 const helperNode = nodes.find(
469 (n) => n.kind === 'module' && n.name === name
470 );
471 if (helperNode) {
472 return helperNode.id;
473 }
474 }
475
476 return null;
477}
478
479function resolveService(name: string, context: ResolutionContext): string | null {
480 const snakeName = name.replace(/([A-Z])/g, '_$1').toLowerCase().slice(1);

Callers 1

resolveFunction · 0.70

Calls 2

fileExistsMethod · 0.80
getNodesInFileMethod · 0.65

Tested by

no test coverage detected