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

Function is_constant_path

codegraph-kernel/src/ruby.rs:1166–1175  ·  view source on GitHub ↗

A constant, or a `scope_resolution` path of constants (`A::B::C`, a top-level `::A` / `::A::B`): what Ruby reads as a constant (isRubyConstantPath).

(node: Node)

Source from the content-addressed store, hash-verified

1164/// A constant, or a `scope_resolution` path of constants (`A::B::C`, a
1165/// top-level `::A` / `::A::B`): what Ruby reads as a constant (isRubyConstantPath).
1166fn is_constant_path(node: Node) -> bool {
1167 match node.kind() {
1168 "constant" => true,
1169 "scope_resolution" => {
1170 node.child_by_field_name("name").map_or(false, |n| n.kind() == "constant")
1171 && node.child_by_field_name("scope").map_or(true, is_constant_path)
1172 }
1173 _ => false,
1174 }
1175}
1176
1177/// isRubyClassMethod (languages/ruby.ts): `def self.x` / `def Widget.x` (a
1178/// singleton_method), or a `def` inside `class << self`.

Callers 2

constructed_classMethod · 0.85
extract_callMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected