MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / parse_ruby_imports

Function parse_ruby_imports

internal/cbm/extract_imports.c:727–755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

725}
726
727static void parse_ruby_imports(CBMExtractCtx *ctx) {
728 CBMArena *a = ctx->arena;
729
730 TSTreeCursor cursor = ts_tree_cursor_new(ctx->root);
731 if (!ts_tree_cursor_goto_first_child(&cursor)) {
732 ts_tree_cursor_delete(&cursor);
733 return;
734 }
735 do {
736 TSNode node = ts_tree_cursor_current_node(&cursor);
737 const char *kind = ts_node_type(node);
738 if (strcmp(kind, "call") != 0 && strcmp(kind, "command_call") != 0) {
739 continue;
740 }
741
742 if (!ruby_require_method(a, node, ctx->source)) {
743 continue;
744 }
745
746 char *arg_text = extract_ruby_require_arg(a, node, ctx->source);
747 if (!arg_text || !arg_text[0]) {
748 continue;
749 }
750
751 CBMImport imp = {.local_name = path_last(a, arg_text), .module_path = arg_text};
752 cbm_imports_push(&ctx->result->imports, a, imp);
753 } while (ts_tree_cursor_goto_next_sibling(&cursor));
754 ts_tree_cursor_delete(&cursor);
755}
756
757// --- Lua imports ---
758// function_call: require("X")

Callers 1

cbm_extract_importsFunction · 0.85

Calls 4

ruby_require_methodFunction · 0.85
extract_ruby_require_argFunction · 0.85
path_lastFunction · 0.85
cbm_imports_pushFunction · 0.85

Tested by

no test coverage detected