MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _ruby_const_last_name

Function _ruby_const_last_name

graphify/extract.py:3363–3373  ·  view source on GitHub ↗

Last constant of a ``constant`` or ``scope_resolution`` (``A::B::C`` -> ``C``).

(node, source: bytes)

Source from the content-addressed store, hash-verified

3361
3362
3363def _ruby_const_last_name(node, source: bytes) -> str:
3364 """Last constant of a ``constant`` or ``scope_resolution`` (``A::B::C`` -> ``C``)."""
3365 if node is None:
3366 return ""
3367 if node.type == "constant":
3368 return _read_text(node, source)
3369 if node.type == "scope_resolution":
3370 consts = [c for c in node.children if c.type == "constant"]
3371 if consts:
3372 return _read_text(consts[-1], source)
3373 return ""
3374
3375
3376# `Const = <factory>(...)` shapes that define a lightweight class named after the

Callers 3

_ruby_extra_walkFunction · 0.85
walkFunction · 0.85
walk_callsFunction · 0.85

Calls 1

_read_textFunction · 0.90

Tested by

no test coverage detected