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

Function ruby_require_method

internal/cbm/extract_imports.c:1217–1230  ·  view source on GitHub ↗

Check if a Ruby call node is a require/require_relative, return method name or NULL.

Source from the content-addressed store, hash-verified

1215
1216// Check if a Ruby call node is a require/require_relative, return method name or NULL.
1217static const char *ruby_require_method(CBMArena *a, TSNode node, const char *source) {
1218 TSNode method = ts_node_child_by_field_name(node, TS_FIELD("method"));
1219 if (ts_node_is_null(method) && ts_node_child_count(node) > 0) {
1220 method = ts_node_child(node, 0);
1221 }
1222 if (ts_node_is_null(method)) {
1223 return NULL;
1224 }
1225 char *name = cbm_node_text(a, method, source);
1226 if (!name || (strcmp(name, "require") != 0 && strcmp(name, "require_relative") != 0)) {
1227 return NULL;
1228 }
1229 return name;
1230}
1231
1232// Extract string argument from a Ruby require/require_relative call.
1233static char *extract_ruby_require_arg(CBMArena *a, TSNode node, const char *source) {

Callers 1

parse_ruby_importsFunction · 0.85

Calls 1

cbm_node_textFunction · 0.85

Tested by

no test coverage detected